Filter hook 'rest_url_prefix'

in WP Core File wp-includes/rest-api.php at line 480

View Source

rest_url_prefix

Filter Hook
Description
Filters the REST URL prefix.

Hook Information

File Location wp-includes/rest-api.php View on GitHub
Hook Type Filter
Line Number 480

Hook Parameters

Type Name Description
string $prefix URL prefix. Default 'wp-json'.

Usage Examples

Basic Usage
<?php
// Hook into rest_url_prefix
add_filter('rest_url_prefix', 'my_custom_filter', 10, 1);

function my_custom_filter($prefix) {
    // Your custom filtering logic here
    return $prefix;
}

Source Code Context

wp-includes/rest-api.php:480 - How this hook is used in WordPress core
<?php
 475  	 *
 476  	 * @since 4.4.0
 477  	 *
 478  	 * @param string $prefix URL prefix. Default 'wp-json'.
 479  	 */
 480  	return apply_filters( 'rest_url_prefix', 'wp-json' );
 481  }
 482  
 483  /**
 484   * Retrieves the URL to a REST endpoint on a site.
 485   *

PHP Documentation

<?php
/**
	 * Filters the REST URL prefix.
	 *
	 * @since 4.4.0
	 *
	 * @param string $prefix URL prefix. Default 'wp-json'.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/rest-api.php
Related Hooks

Related hooks will be displayed here in future updates.