Get All WordPress Navigation Menus

in Navigation Menus

Wordpress menu

If you are creating a custom themes options page or a WordPress plugin which needs to get all the WordPress menus in your site. This small function can be very useful, it will return all the WordPress menus on your site in an array so you can process them as you want.

This uses the WordPress function get_terms() to get all the nav_menu's on the site.

function get_all_wordpress_menus(){
    return get_terms( 'nav_menu', array( 'hide_empty' => true ) ); 
}

Subscribe To Newsletter

Get weekly updates to your email