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 solved the problem with the page, the correct answer is ptriek's comment below.

Well I'm having a bit of an odd problem here, wp_nav_menu works on all pages EXCEPT my category pages (probably my archive page too but there's no links on the website to the archive pages so that's alright).

Although there is archive.php in my theme files, this controls what is displayed on category, tag, archive, author, etc. pages.

I just don't understand why, since every page uses the same header.php to display wp_nav_menu, it won't show up for the category pages.

Am I overlooking something? I've been banging my head against my keyboard trying to figure this out and it just won't work!

Using a very simple code: <?php wp_nav_menu('container_class=menu-header&theme_location=primary'); ?>

share|improve this question
you could have look on wordpress.org/support/topic/… - see solution at the bottom (haven't tested it though) – ptriek Dec 1 '11 at 13:56
That actually works, nice! Thanks. – Jared Dec 1 '11 at 14:01

I had the same problem, but with a newer version of Wordpress (3.7.1).

On pages with custom taxonomies of custom posts, the wp_nav_menu was not shown. The solution below worked for me.

in functions.php of the theme:

add_action( 'pre_get_posts', 'my_pre_get_posts' );
function my_pre_get_posts($query) {
  if ($query->get('post_type') === 'nav_menu_item') {
share|improve this answer
This worked for me with Wordpress 4.0 as well. – abaumg Oct 3 '14 at 14:40
Thanks! Spent hours looking for solution, this worked like a charm... – user1049961 Apr 9 '15 at 14:55

Implode's answer is right and helped me a lot. I tried to implement a hook (pre_get_posts) for avoiding to display posts of subcategories. My hook worked well despite of no more Nav-Menus.

So, when change the tax_query you have to avoid doing this for the query with post_type == 'nav_menu_item'.

share|improve this answer
up vote 0 down vote accepted

This question was answered by ptriek, a shame he didn't post his answer so I could accept it, but for the sake of completeness I will answer it. The solution was found here:


share|improve this answer

Answer by Implode solve issue only if you are not using other queries like 'meta_key' even . I found complete solution here.

function fix_nav_menu( $query ) {
    if ( $query->get( 'post_type' ) === 'nav_menu_item' ) {
        $query->set( 'tax_query', '' );
        $query->set( 'meta_key', '' );
        $query->set( 'orderby', '' );

add_action( 'pre_get_posts', 'fix_nav_menu' );
share|improve this answer
The question was solved. Please don't add extra answer! – Dan9 May 6 at 16:00
@Dan, I had the same issue, but with little bit different situation. This answer wasn't solved my issue but link I found solved it. So maybe somebody else will find this answer helpful. – sambua May 6 at 18:01

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.