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:

functions.php
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.

  1. LiteSpeed Cache icon LiteSpeed Cache7+ million installs apply_filters( 'rest_url_prefix', 'wp-json' ) src/router.cls.php:207
  2. The Events Calendar icon The Events Calendar600,000+ installs apply_filters( 'rest_url_prefix', 'wp-json' ) common/src/Tribe/REST/Main.php:40
  3. WPML Multilingual & Multicurrency for WooCommerce icon WPML Multilingual & Multicurrency for WooCommerce100,000+ installs apply_filters( 'rest_url_prefix', 'wp-json' ) inc/missing-php-functions.php:55
  4. Event Tickets and Registration icon Event Tickets and Registration90,000+ installs apply_filters( 'rest_url_prefix', 'wp-json' ) common/src/Tribe/REST/Main.php:40
  5. Core Framework icon Core Framework10,000+ installs apply_filters( 'rest_url_prefix', 'wp-json' ) wp/Common/Traits/Requester.php:114
  6. Bookit icon Bookit4,000+ installs apply_filters( 'rest_url_prefix', 'wp-json' ) src/Bookit/REST/V1/Traits/REST_Namespace.php:87
  7. Coupon Creator icon Coupon Creator1,000+ installs apply_filters( 'rest_url_prefix', 'wp-json' ) plugin-engine/src/Pngx/REST/Main.php:41
  8. Ensomedia Security powered by shieldwave.io icon 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.