WordPress filter hook
jetpack_get_file_for_environment
Defined by Jetpack and fired by 28 plugins in total, running on 4M+ sites between them.
“Filters the URL for a file passed through the get_file_url_for_environment function.”
How to use jetpack_get_file_for_environment
It's a filter: your callback receives the value and 2 more arguments, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'jetpack_get_file_for_environment', function( $url, $min_path, $non_min_path ) {
// Change $url here.
return $url;
}, 10, 3 );Argument names come from Jetpack's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
28 plugins that fire jetpack_get_file_for_environment
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
Jetpack3+ million installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:194 -
Social Chat200,000+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:193 -
Jetpack Boost200,000+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:194 -
Jetpack Protect100,000+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:194 -
Social Feed Gallery80,000+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:193 -
Checkout Field Manager (Checkout Manager) for WooCommerce80,000+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:193 -
Direct Checkout for WooCommerce70,000+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:193 -
Search Exclude50,000+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:193 -
Perfect Brands for WooCommerce40,000+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:193 -
Autocomplete WooCommerce Orders30,000+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:193 -
Jetpack Social30,000+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:194 -
Jetpack CRM30,000+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:170 -
Jetpack VaultPress Backup20,000+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:194 -
Automattic For Agencies Client20,000+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:194 -
WP Menu Icons20,000+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:193 -
Ajax add to cart for WooCommerce10,000+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:193 -
QuadMenu10,000+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:193 -
Jetpack VideoPress7,000+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:194 -
QuadLayers TikTok Feed7,000+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:193 -
Jetpack Search5,000+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:194 -
Change Storefront Footer Copyright Text3,000+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:193 -
AI Copilot1,000+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:193 -
Jetpack Stats1,000+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:194 -
QuadLayers Telegram Button1,000+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:193 -
PayPal Payment Buttons500+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:194 -
Lifetime Subscriptions for WooCommerce40+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:193 -
Invoice Manager for WooCommerce30+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:193 -
Licenses Manager for WooCommerce10+ installs
apply_filters( 'jetpack_get_file_for_environment', $url, $min_path, $non_min_path )jetpack_vendor/automattic/jetpack-assets/src/class-assets.php:193
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.