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,

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' );

By Chandra Patel

I fell in love with WordPress in 2014 while freelancing as a web developer. I have grown since then to become a Core contributor, Translation contributor for Gujarati, and has contributed to WordPress Meta projects. Over the years, I have developed a love for learning, and hope to learn WordPress ever more “deeply”.

Leave a Reply

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

%d bloggers like this: