WP_REST_Menus_Controller::prepare_links() – Prepares links for the request.

You appear to be a bot. Output may be restricted

Description

Prepares links for the request.

Usage

$array = WP_REST_Menus_Controller::prepare_links( $term );

Parameters

$term
( WP_Term ) required – Term object.

Returns

array Links for the given term.

Source

File name: wordpress/wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php


Lines:

1 to 16 of 16
  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;
  }
 

 View on GitHub View on Trac