Prepares attachment links for the request.
Parameters
$postWP_Postrequired- Post object.
Source
protected function prepare_links( $post ) {
$links = parent::prepare_links( $post );
if ( ! empty( $post->post_parent ) ) {
$post = get_post( $post->post_parent );
if ( ! empty( $post ) ) {
$links['https://api.w.org/attached-to'] = array(
'href' => rest_url( rest_get_route_for_post( $post ) ),
'embeddable' => true,
'post_type' => $post->post_type,
'id' => $post->ID,
);
}
}
return $links;
}
Changelog
| Version | Description |
|---|---|
| 6.9.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.