rest_get_url_prefix

Retrieves the URL prefix for any API resource.

Description

(string) rest_get_url_prefix(); 

Returns (string)

Prefix.


Usage

  1. if ( !function_exists( 'rest_get_url_prefix' ) ) { 
  2. require_once ABSPATH . WPINC . '/rest-api.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = rest_get_url_prefix(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/rest-api.php  
  1. function rest_get_url_prefix() { 
  2. /** 
  3. * Filters the REST URL prefix. 
  4. * @since 4.4.0 
  5. * @param string $prefix URL prefix. Default 'wp-json'. 
  6. */ 
  7. return apply_filters( 'rest_url_prefix', 'wp-json' );