Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to add a custom class to the <a class="custom"> element that is outputted from wp_nav_menu().

Is it possible to do this?

The reason if you're curious: I don't want to use li.menu-item a {} to select this element, as that would require the browser to cross-check all <a> elements; not very efficient for pages with a ton of a elements. With a custom class I can select and style, in one pass, just the .custom elements.

share|improve this question
You might want to check into a Walker Function, toward the bottom there's "link attributes" where you might be able to add a class. –  Howdy_McGee Sep 6 '13 at 19:13

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.