WP_REST_Menus_Controller::prepare_links()
Prepares links for the request.
Метод класса: WP_REST_Menus_Controller{}
Хуков нет.
Возвращает
Массив
. Links for the given term.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->prepare_links( $term );
- $term(WP_Term) (обязательный)
- Term object.
Список изменений
С версии 5.9.0 | Введена. |
Код WP_REST_Menus_Controller::prepare_links() WP REST Menus Controller::prepare links WP 6.7.1
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; }