Last active
September 29, 2019 09:34
-
-
Save samuelaguilera/5e2ad8bd7b3996df501202585ab013d2 to your computer and use it in GitHub Desktop.
This file contains 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 characters
<?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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This isn't working on my site, is there a new method to fix gforms to make it compatible with rocket loader?