WP_REST_Menus_Controller::get_term() – Gets the term, if the ID is valid.

You appear to be a bot. Output may be restricted

Description

Gets the term, if the ID is valid.

Usage

$WP_Term|WP_Error = WP_REST_Menus_Controller::get_term( $id );

Parameters

$id
( int ) required – Supplied ID.

Returns

WP_Term|WP_Error Term object if ID is valid, WP_Error otherwise.

Source

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


Lines:

1 to 13 of 13
  protected function get_term( $id ) {
    $term = parent::get_term( $id );

    if ( is_wp_error( $term ) ) {
      return $term;
    }

    $nav_term           = wp_get_nav_menu_object( $term );
    $nav_term->auto_add = $this->get_menu_auto_add( $nav_term->term_id );

    return $nav_term;
  }
 

 View on GitHub View on Trac