WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm creating a template in HTML5. On navigatiom menu i need to implement something like this

 <a href="url1">url1</a>
 <a href="url1">url2</a>
 <a href="url1">url3</a>
 <a href="url1">url4</a>
 <a href="urln">urln</a>

If i use 'wp_nav_menu', it prints


when i need just


There is a way to get that? Thanks!

share|improve this question
up vote 1 down vote accepted

Use a custom walker:

class WPSE_33175_Simple_Walker extends Walker
    public function walk( $elements, $max_depth )
        $list = array ();

        foreach ( $elements as $item )
            $list[] = "<a href='$item->url'>$item->title</a>";

        return join( "\n", $list );

… and then call wp_nav_menu() like this:

    array (
        'theme_location' => 'your_registered_theme_location',
        'walker'         => new WPSE_33175_Simple_Walker,
        'items_wrap'     => '<nav>%3$s</nav>'
share|improve this answer

I'd suggest using the wp_nav_menu_items filter.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.