Title: wp_nav_menu =&gt; array
Last modified: August 20, 2016

---

# wp_nav_menu => array

 *  [cannon303](https://wordpress.org/support/users/cannon303/)
 * (@cannon303)
 * [15 years ago](https://wordpress.org/support/topic/wp_nav_menu-array/)
 * Hi does anyone know how to output wp_nav_menu into a simple array rather than
   a string?
 * Thanks

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [Curtiss Grymala](https://wordpress.org/support/users/cgrymala/)
 * (@cgrymala)
 * [15 years ago](https://wordpress.org/support/topic/wp_nav_menu-array/#post-2114097)
 * Probably the best way to do so is to define a custom “walker” for the nav menu;
   but I haven’t done that yet, so I can’t give much guidance on what the “walker”
   needs to do.
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years ago](https://wordpress.org/support/topic/wp_nav_menu-array/#post-2114101)
 * Very crude:
 *     ```
       <?php
       $test = wp_nav_menu( 'echo=0' );
       $test = explode("\n", $test);
       ?>
       ```
   
 *  Thread Starter [cannon303](https://wordpress.org/support/users/cannon303/)
 * (@cannon303)
 * [15 years ago](https://wordpress.org/support/topic/wp_nav_menu-array/#post-2114112)
 * Curtiss Grymala yes I have no experience of “walker” either I’ll have to see 
   if i can learn it and esmi yup that seems to be the road i’m going down. My php
   is usually crude!
 * Thanks for both of your replies, the quest continues….
 *  Thread Starter [cannon303](https://wordpress.org/support/users/cannon303/)
 * (@cannon303)
 * [15 years ago](https://wordpress.org/support/topic/wp_nav_menu-array/#post-2114144)
 * This is the third thread I’ve posted on this subject and completely drawn a blank,
   I can’t believe this is so difficult!
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years ago](https://wordpress.org/support/topic/wp_nav_menu-array/#post-2114151)
 * wp_nav_menu() is a relatively new function and – unlike some of the older templating
   tags – it isn’t built upon lower level functions that can be successfully re-
   used. A custom Walker class is definitely the best way to go but, like Curtiss,
   it’s not something I’ve had reason to play with yet.
 *  Thread Starter [cannon303](https://wordpress.org/support/users/cannon303/)
 * (@cannon303)
 * [15 years ago](https://wordpress.org/support/topic/wp_nav_menu-array/#post-2114176)
 * yes I’m looking into walkers, it’s very difficult to get my head round it especially
   as i can’t see anyone asking the same question as i am in the context of walkers.
 *  Thread Starter [cannon303](https://wordpress.org/support/users/cannon303/)
 * (@cannon303)
 * [15 years ago](https://wordpress.org/support/topic/wp_nav_menu-array/#post-2114339)
 * Well I’ve pretty much exhausted every walker tutorial and forum query. There 
   just isn’t enough out there to help me with what i want.
 * I wouldn’t class myself as possessing a thorough and in depth knowledge of PHP
   being self taught, but can generally get by, however I’m no better equipped to
   grapple the concept of wordpress walkers and therefore no closer to my goal and
   have to admit defeat.
 * There’s a workaround function tutorial which I followed and that works how I 
   want the menu to work. This doesn’t work with any menus set up in admin=>appearance
   =>menus and doesn’t work with wp_nav_menu() function but instead, uses the hierarchical
   structure of the old style parent attributes in the admin=> pages facility.
 * It’s a shame because my clients will understand the graphical nature of the menu
   editing facility and the drag and drop method and instead they will have to assign
   parents to sub pages and sub page parents to sub – sub pages via drop down menus
   and will have to give each page a numerical order ID to assign placement within
   the menu which is confusing to say the least.
 * What a shame. I would like to leave this thread open please as I would like to
   crack this even if it is too late for this deadline.
 *  [Babak Fakhamzadeh](https://wordpress.org/support/users/mastababa/)
 * (@mastababa)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/wp_nav_menu-array/#post-2114670)
 * I had the same issue, implementing a Bootstrap-based design onto a WordPress 
   template. My solution ain’t elegant, but it works:
 * _[[code moderated per forum rules](http://codex.wordpress.org/Forum_Welcome#Posting_Code)–
   to share your solution, please use the [pastebin](http://pastebin.com/)]_

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘wp_nav_menu => array’ is closed to new replies.

## Tags

 * [array](https://wordpress.org/support/topic-tag/array/)
 * [wp_nav_menu()](https://wordpress.org/support/topic-tag/wp_nav_menu/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 4 participants
 * Last reply from: [Babak Fakhamzadeh](https://wordpress.org/support/users/mastababa/)
 * Last activity: [14 years, 4 months ago](https://wordpress.org/support/topic/wp_nav_menu-array/#post-2114670)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
