function wp_get_nav_menu_object( $menu ) {}

Returns a navigation menu object.


  • string $menu: Menu id, slug or name

Return values

returns:false if $menu param isn’t supplied or term does not exist, menu object if successful.

Source code

function wp_get_nav_menu_object( $menu ) {

	if ( ! $menu )

		return false;

	$menu_obj = get_term( $menu, 'nav_menu' );

	if ( ! $menu_obj )

		$menu_obj = get_term_by( 'slug', $menu, 'nav_menu' );

	if ( ! $menu_obj )

		$menu_obj = get_term_by( 'name', $menu, 'nav_menu' );

	if ( ! $menu_obj )

		$menu_obj = false;

	return $menu_obj;



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: