Often I am converting old WordPress sites or working with custom page or post types. When you try to force something other than posts to show in category pages, the main navigation menus fail to display. The core WordPress wp_nav_menu() function doesn’t know what to do in those cases and returns nothing.
Code Solution:
if(is_category()) { $thiscat_id=get_query_var('cat'); $backup=$wp_query; $wp_query = NULL; $wp_query = new WP_Query(array('post_type' => 'any')); } wp_nav_menu( $defaults ); if($thiscat_id!="") { $wp_query=$backup; }
Continue reading “Why WordPress Main Menu Navigation is Missing from Categories”