WordPress filter hook · part of WordPress core
rest_url
A WordPress core filter that 8 plugins also fire themselves, running on 202K+ sites between them.
“Part of the URL's identity — a site that moves its REST root does it here, and skipping it would return a different string than rest_url() does.”
How to use rest_url
It's a filter: your callback receives the value and 3 more arguments, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'rest_url', function( $url, $path, $arg3, $arg4 ) {
// Change $url here.
return $url;
}, 10, 4 );Argument names come from NIBWP'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
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
Anti-Spam, Spam FireWall by CleanTalk200,000+ installs
apply_filters( 'rest_url', $url, $path, $blog_id, $scheme )inc/cleantalk-pluggable.php:238 -
Appointment Bookings for Zoom GoogleMeet and more1,000+ installs
apply_filters( 'rest_url', $url, $path, $blog_id, $scheme )app/System/Compatibility.php:55 -
NIBWP300+ installs
apply_filters( 'rest_url', $url, $path, null, 'rest' )includes/oauth/oauth.php:95 -
SaddleWP100+ installs
apply_filters( 'rest_url', $url, $path, null, 'rest' )includes/oauth/class-saddle-oauth.php:270 -
SiteFort Security100+ installs
apply_filters( 'rest_url', $url, '/', $owner, 'rest' )includes/InstallationScope.php:186 -
Zorem AI Agent Connector50+ installs
apply_filters( 'rest_url', $url, $path, null, 'rest' )includes/OAuth/OAuthEndpoints.php:122 -
Rectus Content Access for MCP30+ installs
apply_filters( 'rest_url', $url, '/' . $route, null, 'rest' )includes/oauth.php:309 -
NovasiraFewer than 10 installs
apply_filters( 'rest_url', $url, $path, null, 'rest' )includes/auth/auth.php:92
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.