MainWP Community

Fix Stats WordPress.com Scripts Path in Jetpack

Fix the script path for Stats WordPress.com request when using Jetpack 8.6 version plugin on your child site.

Snippet Type

Execute on Child Sites

Snippet

function jetpackcom_fix_woo_script_path( $url, $min_path, $non_min_path ) {
	if ( wp_startswith( $min_path, 'https://stats.wp.com/s-' ) ) {
		return $min_path;
	}

	return $url;
}
add_filter( 'jetpack_get_file_for_environment', 'jetpackcom_fix_woo_script_path', 10, 3 );
1 Like

Will be fixed in version 8.7 of Jetpack released in July.