How can I get GravityForms to stop adding it's script to specific pages with PHP?

Viewed 347

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.

1 Answers
Related