Skip to content

Instantly share code, notes, and snippets.

@samuelaguilera
Last active September 29, 2019 09:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samuelaguilera/5e2ad8bd7b3996df501202585ab013d2 to your computer and use it in GitHub Desktop.
Save samuelaguilera/5e2ad8bd7b3996df501202585ab013d2 to your computer and use it in GitHub Desktop.
<?php
// NOTE: The code to copy/paste starts below this line
// Don't apply Rocket Loader to scripts needed by Gravity Forms
add_filter( 'script_loader_tag', 'sar_gf_rocket_loader_safe', 10, 3 );
function sar_gf_rocket_loader_safe( $tag, $handle, $src ){
if ( strpos( $handle, 'gform' ) !== false || 'plupload-all' === $handle ) {
return str_replace( "src='", "data-cfasync='false' src='", $tag );
} else {
return $tag;
}
}
@jazir555
Copy link

jazir555 commented Aug 4, 2019

This isn't working on my site, is there a new method to fix gforms to make it compatible with rocket loader?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment