WP_REST_Menus_Controller::prepare_links()
Prepares links for the request.
Method of the class: WP_REST_Menus_Controller{}
No Hooks.
Return
Array
. Links for the given term.
Usage
// protected - for code of main (parent) or child class $result = $this->prepare_links( $term );
- $term(WP_Term) (required)
- Term object.
Changelog
Since 5.9.0 | Introduced. |
WP_REST_Menus_Controller::prepare_links() WP REST Menus Controller::prepare links code WP 6.6.2
protected function prepare_links( $term ) { $links = parent::prepare_links( $term ); $locations = $this->get_menu_locations( $term->term_id ); foreach ( $locations as $location ) { $url = rest_url( sprintf( 'wp/v2/menu-locations/%s', $location ) ); $links['https://api.w.org/menu-location'][] = array( 'href' => $url, 'embeddable' => true, ); } return $links; }