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 building a theme and have noticed that when I create a menu with just html or have it dynamically add menu items based on pages it looks how it was meant to be. Although when I change the code to generate the menu from the menu editor it adds alot of extra padding to the menu.

Is this a wordpress issue? Has anyone heard of this before? Here is an example.

When I generate a menu using the menu editor it adds padding:

 <div class="header">
    <div class="nav">



       <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>



When I generate a menu through just hardcoding HTML it looks fine:

<div class="header">
    <div class="nav">
        <li><a href="#home">Home</a></li>
        <li><a href="#about">About</a></li>
        <li><a href="#portfolio">Portfolio</a></li>
        <li><a href="#support">Support</a></li>

Problem has been solved. I removed both the <ul> and <li> tags and the navigation is in it's proper location.

<div class="header">
        <div class="nav">

           <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
share|improve this question
wp_nav_menu generates a full unordered list - having it within <li> tags like your first block of code would mean the generated menu is a list-within-a-list, which may explain the padding... – Andy Adams May 2 '13 at 0:39
Are you referring to extra whitespace in the markup or padding in terms of CSS and alignment? – EAMann May 2 '13 at 0:41
Referring to padding in terms of CSS. It is using the same classes when I check but for some reason the links are moved down quite a bit. – user1632018 May 2 '13 at 2:02
@AndyAdams I tried removing the <li> and I am having the same issue. I have my own li and ul classes that I use. When I check to see what it is using it is inheriting extra classes from a user agent stylesheet for those. So it appears that it is ignoring my classes. I don't know how to switch it back though. – user1632018 May 2 '13 at 2:19
Oops. I didn't see that it added extra <UL> tags aswell. After removing those it seems to work. – user1632018 May 2 '13 at 2:56

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.