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.

/**
  * 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

Your email address will not be published. Required fields are marked *