WP_REST_Menu_Items_Controller::get_nav_menu_item( int $id ): object|WP_Error

Gets the nav menu item, if the ID is valid.


Parameters

$id int Required
Supplied ID.

Top ↑

Return

object|WP_Error Post object if ID is valid, WP_Error otherwise.


Top ↑

Source

File: wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php. View all references

protected function get_nav_menu_item( $id ) {
	$post = $this->get_post( $id );
	if ( is_wp_error( $post ) ) {
		return $post;
	}

	return wp_setup_nav_menu_item( $post );
}


Top ↑

Changelog

Changelog
Version Description
5.9.0 Introduced.

Top ↑

User Contributed Notes

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