Navigation Menus

Get All WordPress 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 ) ); 
Back to top

Gain access to all tutorials

  • Premium tutorials covering WordPress, Laravel and VueJS
  • Download premium content
  • Download premium WordPress plugins
  • Only $5 a month

Join Paulund