wp_get_nav_menu_items


wp_get_nav_menu_items ( $menu, $args = array() )

Parameters:
  • (int|string|WP_Term) menu Menu ID, slug, name, or object.
  • (array) args { Optional. Arguments to pass to get_posts(). @type string $order How to order nav menu items as queried with get_posts(). Will be ignored if 'output' is ARRAY_A. Default 'ASC'. @type string $orderby Field to order menu items by as retrieved from get_posts(). Supply an orderby field via 'output_key' to affect the output order of nav menu items. Default 'menu_order'. @type string $post_type Menu items post type. Default 'nav_menu_item'. @type string $post_status Menu items post status. Default 'publish'. @type string $output How to order outputted menu items. Default ARRAY_A. @type string $output_key Key to use for ordering the actual menu items that get returned. Note that that is not a get_posts() argument and will only affect output of menu items processed in this function. Default 'menu_order'. @type bool $nopaging Whether to retrieve all menu items (true) or paginate (false). Default true. }
Returns:
  • (array|bool) Array of menu items, otherwise false.
Defined at:

Description

Retrieves all menu items of a navigation menu.Note: Most arguments passed to the `$args` parameter – save for 'output_key' – are specifically for retrieving nav_menu_item posts from get_posts() and may only indirectly affect the ultimate ordering and content of the resulting nav menu items that get returned from this function.

Related Functions

wp_save_nav_menu_items, wp_setup_nav_menu_item, wp_get_nav_menus, _sort_nav_menu_items, wp_get_nav_menu_name

Top Google Results

User discussions

wpseek mobile