Retrieves all menu items of a navigation menu.


wp_get_nav_menu_items( int|string|WP_Term $menu, array $args = array() )


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.



(int|string|WP_Term) (Required) Menu ID, slug, name, or object.


(array) (Optional) Arguments to pass to get_posts().

  • 'order'
    (string) How to order nav menu items as queried with get_posts(). Will be ignored if 'output' is ARRAY_A. Default 'ASC'.
  • 'orderby'
    (string) 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'.
  • 'post_type'
    (string) Menu items post type. Default 'nav_menu_item'.
  • 'post_status'
    (string) Menu items post status. Default 'publish'.
  • 'output'
    (string) How to order outputted menu items. Default ARRAY_A.
  • 'output_key'
    (string) 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'.
  • 'nopaging'
    (bool) Whether to retrieve all menu items (true) or paginate (false). Default true.

Default value: array()


(array|false) $items Array of menu items, otherwise false.


File: wp-includes/nav-menu.php



Version Description
3.0.0 Introduced.
Scroll to Top