acf_field::get_rest_links
Return an array of links for addition to the REST API response. Each link is an array and must have both rel and href keys. The href key must be a REST API resource URL. If a link is marked as embeddable, the _embed URL parameter will trigger WordPress to dispatch an internal sub request and load the object within the same request under the _embedded response property.
e.g;
[ [ 'rel' => 'acf:post', 'href' => 'https://example.com/wp-json/wp/v2/posts/497', 'embeddable' => true, ], [ 'rel' => 'acf:user', 'href' => 'https://example.com/wp-json/wp/v2/users/2', 'embeddable' => true, ], ]
Method of the class: acf_field{}
No Hooks.
Returns
Array.
Usage
$acf_field = new acf_field(); $acf_field->get_rest_links( $value, $post_id, $field );
- $value(mixed) (required)
- The raw (unformatted) field value.
- $post_id(string|int) (required)
- .
- $field(array) (required)
- .
acf_field::get_rest_links() acf field::get rest links code ACF 6.0.4
public function get_rest_links( $value, $post_id, array $field ) {
return array();
}