Some time we required to display menu item in custom as per design.
Recently i worked on one wordpress project but this projects designs are differently from other projects. Here main Problem is that display menu links in custom way.
I researched some time in Google about wp nav menu but i didn’t find solutions for display custom menu our own way. Some of people saying that use custom wp nav menu or change the core files but these not recommend by wordpress .
Finally i checked wordpress fuction refernce in Codex here i found dome of useful functions but it’s really useful fuction refernce on codex everyone should read WordPress fuction reference before any project handle
However i found wp_get_nav_menu_items fuction to get menu items in custom foreach loop
Using wp_get_nav_menu_items() fuction you will get the all menus object but you need to call menu term id in this function parameter.
For menu term id you need to call the wp_get_nav_menu_object but need to some pass parameters like menu name or menu location.
See below example to get menu object
&lt;?php $menu_name = 'sidebar-menu'; //menu slug or menu location $locations = get_nav_menu_locations(); $menu = wp_get_nav_menu_object( $locations[ $menu_name ] ); $menuitems = wp_get_nav_menu_items( $menu-&gt;term_id, array( 'order' =&gt; 'DESC' ) ); echo "&lt;pre&gt;"; print_r($menuitems); echo "&lt;/pre&gt;"; ?&gt;