in WordPress

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 ) ); 
}

Upgrade to access all content on Paulund

Members unlock all tutorials and snippets

Access to all downloadable content

Access to code examples before others

Sign Up Now

Already a member? Login here

Subscribe To The Weekly Newsletter

Get weekly updates to your email