Exclude Gravity Forms Inline Scripts from CloudFlare’s Rocket Loaderâ„¢.

Experimental Snippet 🧪

Code

Filename: gpnf-exclude-gf-inline-scripts-from-cloudflare-rocket-loader.php

<?php
/**
 * Gravity Perks // Nested Forms // Exclude Gravity Forms Inline Scripts from CloudFlare's Rocket Loaderâ„¢.
 * https://gravitywiz.com/documentation/gravity-forms-nested-forms/
 *
 * Experimental Snippet 🧪
 */
add_filter( 'wp_inline_script_attributes', function ( $attributes, $javascript ) {
	if ( strpos( $javascript, 'gform.' ) ) {
		$attributes['data-cfasync'] = 'false';
	}
	return $attributes;
}, 10, 2 );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.