WordPress filter hook · part of WordPress core
rest_url_prefix
A WordPress core filter that 8 plugins also fire themselves, running on 7.8M+ sites between them.
“Bypass post/page link setting”
How to use rest_url_prefix
It's a filter: your callback receives the value, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'rest_url_prefix', function( $value ) {
// Change $value here.
return $value;
}, 10, 1 );Argument names come from LiteSpeed Cache's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
This hook is fired by WordPress core too. Official reference on developer.wordpress.org →
8 plugins that fire rest_url_prefix
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
LiteSpeed Cache7+ million installs
apply_filters( 'rest_url_prefix', 'wp-json' )src/router.cls.php:207 -
The Events Calendar600,000+ installs
apply_filters( 'rest_url_prefix', 'wp-json' )common/src/Tribe/REST/Main.php:40 -
WPML Multilingual & Multicurrency for WooCommerce100,000+ installs
apply_filters( 'rest_url_prefix', 'wp-json' )inc/missing-php-functions.php:55 -
Event Tickets and Registration90,000+ installs
apply_filters( 'rest_url_prefix', 'wp-json' )common/src/Tribe/REST/Main.php:40 -
Core Framework10,000+ installs
apply_filters( 'rest_url_prefix', 'wp-json' )wp/Common/Traits/Requester.php:114 -
Bookit4,000+ installs
apply_filters( 'rest_url_prefix', 'wp-json' )src/Bookit/REST/V1/Traits/REST_Namespace.php:87 -
Coupon Creator1,000+ installs
apply_filters( 'rest_url_prefix', 'wp-json' )plugin-engine/src/Pngx/REST/Main.php:41 -
Ensomedia Security powered by shieldwave.io20+ installs
apply_filters( 'rest_url_prefix', 'wp-json' )includes/protect/class-vpatch.php:794
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.