Chandra Patel

Just Another Developer

REST API – Filter REST URL prefix

REST API architecture is included in WordPress 4.4 version. So you can register custom REST API endpoints. Default REST API URL prefix is wp-json.

For example, http://your-site.com/wp-json/

There is filter to change default REST API URL prefix. This filter is defined within rest_get_url_prefix() function in wp-includes/rest-api.php file.

PHP
/**
 * Filters the REST URL prefix.
 *
 * @since 4.4.0
 *
 * @param string $prefix URL prefix. Default 'wp-json'.
 */
 apply_filters( 'rest_url_prefix', 'wp-json' );

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.