Function removes main menu
-
I’m using the following function in function.php to display a custom post type in the main loop on a custom taxonomy page.
function namespace_add_custom_types( $query ) { if( is_tax() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) { $query->set( 'post_type', 'route' ); return $query; } } add_filter( 'pre_get_posts', 'namespace_add_custom_types' );However when the taxonomy page is displayed the main menu doesn’t load. If I comment out the function the menu loads so I’m pretty sure the template is OK.
Any ideas?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Function removes main menu’ is closed to new replies.