Title: Plugin doesn&#039;t work with PHP called gravity_form() function
Last modified: August 22, 2016

---

# Plugin doesn't work with PHP called gravity_form() function

 *  Resolved [Wil](https://wordpress.org/support/users/limecanvas/)
 * (@limecanvas)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/plugin-doesnt-work-with-php-called-gravity_form-function/)
 * Noticed a little issue with this plugin.
 * I recently had to remove the gravity forms shortcode form a page and build a 
   template which dynamically called the PHP gravity_form() function, inserting 
   dynamic data using the function.
 * The plugin seems to check the post_content for the GF shortcode in function check_for_shortcode(
   $posts ), however, the GF PHP function doesn’t add the shortcode the the post_content,
   so the plugin never fires as the preg_match_all returns nothing.
 * To recap, I have an empty page content in the WP editor but my page template 
   calls the GF PHP function directly. e.g.
 *     ```
       <div class="entry-content">
       			<?php the_content(); ?>
                   <?php
                   // Output the Gravity Form
                   echo gravity_form( 5, $display_title = false, $display_description = false );
                   ?>
                   <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ), 'after' => '</div>' ) ); ?>
       		</div><!-- .entry-content -->
       ```
   
 * You may have to hook into one of the GF hooks. I believe the JavaScript gform_post_render()
   function would work nicely.
 * [http://www.gravityhelp.com/documentation/gravity-forms/extending-gravity-forms/hooks/javascript/gform_post_render/](http://www.gravityhelp.com/documentation/gravity-forms/extending-gravity-forms/hooks/javascript/gform_post_render/)
 * Perhaps you can enqueue it after the page loads on the “wp” action hook and check
   there?
 * Cheerz,
    Wil.
 * [https://wordpress.org/plugins/gravity-forms-force-ssl/](https://wordpress.org/plugins/gravity-forms-force-ssl/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Timothy Wood](https://wordpress.org/support/users/codearachnid/)
 * (@codearachnid)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/plugin-doesnt-work-with-php-called-gravity_form-function/#post-5865757)
 * That was an item on my todo list – the problem is that a clean redirect occurs
   prior to output and if someone hard codes this into their theme then the only
   clean way for a redirect is via JavaScript which is not a reliable mechanism 
   for a secure form. It should be to the theme/plugin developer hard coding the
   form into their code to provide security option. If you wish to help me revise
   this stance i’d be more than happy to reopen the feature request.

Viewing 1 replies (of 1 total)

The topic ‘Plugin doesn't work with PHP called gravity_form() function’ is closed
to new replies.

 * ![](https://ps.w.org/gravity-forms-force-ssl/assets/icon-256x256.png?rev=1057890)
 * [Gravity Forms: Force SSL](https://wordpress.org/plugins/gravity-forms-force-ssl/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gravity-forms-force-ssl/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gravity-forms-force-ssl/)
 * [Active Topics](https://wordpress.org/support/plugin/gravity-forms-force-ssl/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gravity-forms-force-ssl/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gravity-forms-force-ssl/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Timothy Wood](https://wordpress.org/support/users/codearachnid/)
 * Last activity: [10 years, 11 months ago](https://wordpress.org/support/topic/plugin-doesnt-work-with-php-called-gravity_form-function/#post-5865757)
 * Status: resolved