Skip to content

Instantly share code, notes, and snippets.

@adamsilverstein
Last active March 18, 2022 06:12
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save adamsilverstein/9933f3efb479544e6f8a8f026ddf58ca to your computer and use it in GitHub Desktop.
Save adamsilverstein/9933f3efb479544e6f8a8f026ddf58ca to your computer and use it in GitHub Desktop.
Improve compatibility between Site Kit and WP Rocket
<?php
/**
* WP Rocket compatibility for Site Kit.
*
* @wordpress-plugin
* Plugin Name: SiteKit WP Rocket Compatibility
* Description: Improve compatibility between Site Kit and WP Rocket.
* Plugin URI:
* Version: 1.0.0
* Author: Adam Silverstein, Google
* License: Apache License 2.0
* License URI: https://www.apache.org/licenses/LICENSE-2.0
*/
add_filter(
'rocket_exclude_js',
function( $js_files ) {
$js_files = array_push( 'google-site-kit/dist/assets/js/.*\.js' );
return array( $js_files );
}
);
@westonruter
Copy link

s/appay_push/array_push/

@adamsilverstein
Copy link
Author

👍

@aaemnnosttv
Copy link

Can we update it to exclude everything in google-site-kit/dist/? (styles too)

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