WP_REST_Menus_Controller::get_term( int $id ): WP_Term|WP_Error

In this article

Gets the term, if the ID is valid.

Parameters

$idintrequired
Supplied ID.

Return

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

Source

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;
}

Changelog

VersionDescription
5.9.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.