ACF_Rest_Embed_Links::load_item_links
Hook into the rest_prepare_{$type} filters and add links for the object being prepared.
Method of the class: ACF_Rest_Embed_Links{}
No Hooks.
Returns
WP_REST_Response.
Usage
$ACF_Rest_Embed_Links = new ACF_Rest_Embed_Links(); $ACF_Rest_Embed_Links->load_item_links( $response, $item, $request );
- $response(WP_REST_Response) (required)
- .
- $item(WP_Post|WP_User|WP_Term) (required)
- .
- $request(WP_REST_Request) (required)
- .
ACF_Rest_Embed_Links::load_item_links() ACF Rest Embed Links::load item links code ACF 6.0.4
public function load_item_links( $response, $item, $request ) {
if ( empty( $this->links ) ) {
return $response;
}
while ( $attributes = array_pop( $this->links ) ) {
$response->add_link(
acf_extract_var( $attributes, 'rel' ),
acf_extract_var( $attributes, 'href' ),
$attributes
);
}
// Reset the links prop.
$this->links = array();
return $response;
}