Reputation: 830
There are issues I'm having with GravityForms in WordPress adding it's script to each page, which looks like:
<script type="text/javascript">if(!gform){document.addEventListener("gform_main_scripts_loaded",function(){gform.scriptsLoaded=!0}),window.addEventListener("DOMContentLoaded",function(){gform.domLoaded=!0});
etc.
How can I make it so that this script doesn't get added on certain pages, using PHP? (with another plugin, for example)
I don't want to edit GravityForms code as this would obviously break if it was ever updated.
Surely there must be some way to hook in and change the behavior. So far I have looked into using remove_filter
and wp_deregister_script
but have not been successful so far.
Thanks.
Upvotes: 1
Views: 1172
Reputation: 776
This was an issue in Gravity Forms - details here: https://community.gravityforms.com/t/remove-unused-gf-script-from-header-resolved/9937
It was just recently patched, if you update to the latest build, should be fixed.
Upvotes: 2