rest_response_link_curies
Filter HookDescription
Filters extra CURIEs available on REST API responses. 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 `{name}:{rel}`. `{rel}` in the URI template will be replaced with the `{rel}` part of the shortened relation. For example, a CURIE with name `example` and URI template `http://w.org/{rel}` would transform a `http://w.org/term` relation into `example:term`. Well-behaved clients should expand and normalize these back to their full URI relation, however some naive clients may not resolve these correctly, so adding new CURIEs may break backward compatibility.Hook Information
File Location |
wp-includes/rest-api/class-wp-rest-response.php
View on GitHub
|
Hook Type | Filter |
Line Number | 289 |
Hook Parameters
Type | Name | Description |
---|---|---|
array
|
$additional
|
Additional CURIEs to register with the REST API. |
Usage Examples
Basic Usage
<?php
// Hook into rest_response_link_curies
add_filter('rest_response_link_curies', 'my_custom_filter', 10, 1);
function my_custom_filter($additional) {
// Your custom filtering logic here
return $additional;
}
Source Code Context
wp-includes/rest-api/class-wp-rest-response.php:289
- How this hook is used in WordPress core
<?php
284 *
285 * @since 4.5.0
286 *
287 * @param array $additional Additional CURIEs to register with the REST API.
288 */
289 $additional = apply_filters( 'rest_response_link_curies', array() );
290
291 return array_merge( $curies, $additional );
292 }
293 }
PHP Documentation
<?php
/**
* Filters extra CURIEs available on REST API responses.
*
* 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 `{name}:{rel}`. `{rel}` in
* the URI template will be replaced with the `{rel}` part of the
* shortened relation.
*
* For example, a CURIE with name `example` and URI template
* `http://w.org/{rel}` would transform a `http://w.org/term` relation
* into `example:term`.
*
* Well-behaved clients should expand and normalize these back to their
* full URI relation, however some naive clients may not resolve these
* correctly, so adding new CURIEs may break backward compatibility.
*
* @since 4.5.0
*
* @param array $additional Additional CURIEs to register with the REST API.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-includes/rest-api/class-wp-rest-response.php
Related Hooks
Related hooks will be displayed here in future updates.