Quick Fix:: wp_nav_menu not working on category.php

Today while working on a site I came across a problem that seemed weird to me. The wp_nav_menu was working fine on all the pages except for my category page. When I took a detailed look, I found that it was caused by conflict of custom post type.  So how did I fix it?

Well here is a quick fix. Copy and paste the following code right above the place where you have called the wp_nav_menu function.



$wp_query = NULL;
$wp_query = new WP_Query(array(‘post_type’ => ‘post’,’page’));



You may add other post types as per your need.

That’s it for the time being. Let me know if it helped or if it does not too, you could always leave a comment.