Created
November 12, 2015 12:14
Revisions
-
getdave created this gist
Nov 12, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ /** * Force GFORM Scripts inline next to Form Output * * force the script tags inline next to the form. This allows * us to regex them out each time the form is rendered. * * see strip_inline_gform_scripts() function below * which implements the required regex */ function force_gform_inline_scripts() { return false; } add_filter("gform_init_scripts_footer", "force_gform_inline_scripts"); /** * Strip out GForm Script tags * * note: this diables post and pre render hooks which are triggered * when the form renders so if you need these then it's important * to manually re-add them in your compiled JS source code */ function strip_inline_gform_scripts( $form_string, $form ) { return $form_string = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $form_string); } add_filter("gform_get_form_filter", "strip_inline_gform_scripts", 10, 2);