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 am changing wp_nav_menu() to make it a listless navigation menu (i.e., no unordered list or list item tags) Normally the menu <li> has the .current-menu-item class attached to it when active. But is there a way to give it to the anchor instead?

<a class="current-menu-item"></a>

Edit: This is currently what I'm doing to remove the tags... if there's a custom walker solution that would be ideal. I'd prefer not having to resort to using any javascript if possible.

$menuParameters = array(
  'container'       => false,
  'echo'            => false,
  'items_wrap'      => '%3$s',
  'depth'           => 0,

echo strip_tags(wp_nav_menu( $menuParameters ), '<a>' );
share|improve this question
Please elaborate on how exactly are you applying your tweaks. – Rarst Jan 31 '14 at 16:40
I think you'd need to look at a custom Walker for this. Check out the Nav Menu docs for starters, and you'll find the Walker_Nav_Menu class (whcih you extend to make your custom walker) in /wp-includes/nav-menu-template.php. If that is what you want, update the question and I'll be happy to help. – David Gard Jan 31 '14 at 16:41

Your Answer


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

Browse other questions tagged or ask your own question.