rest_response_link_curies

Filters extra CURIEs available on API responses.

Description

apply_filters( 'rest_response_link_curies', (array) $array ); 

CURIEs allow a shortened version of URI relations. This allows a more usable form for custom relations than using the full URI. These work similarly to how XML namespaces work.

Registered CURIES need to specify a name and URI template. This will automatically transform URI relations into their shortened version. The shortened relation follows the format :.. in the URI template will be replaced with the part of the shortened relation.

For example, a CURIE with name example and URI template 'http://w.org/' would transform a http://w.org/term relation into example:term.

Well-behaved clients should expand and normalise these back to their full URI relation, however some naive clients may not resolve these correctly, so adding new CURIEs may break backward compatibility.

Parameters (1)

0. $array (array) => array()
Additional CURIEs to register with the API.

Usage

To run the hook, copy the example below.
  1. $array = apply_filters( 'rest_response_link_curies', $array ); 
  2.  
  3. if ( !empty( $array ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the rest_response_link_curies callback 
  2. function filter_rest_response_link_curies( $array ) { 
  3. // make filter magic happen here... 
  4. return $array
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'rest_response_link_curies', 'filter_rest_response_link_curies', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'rest_response_link_curies', 'filter_rest_response_link_curies', 10, 1 ); 

Defined (1)

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

/wp-includes/rest-api/class-wp-rest-response.php  
  1. $additional = apply_filters( 'rest_response_link_curies', array() );