Title: Function removes main menu
Last modified: August 21, 2016

---

# Function removes main menu

 *  Resolved [compositeone](https://wordpress.org/support/users/compositeone/)
 * (@compositeone)
 * [12 years ago](https://wordpress.org/support/topic/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)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [12 years ago](https://wordpress.org/support/topic/function-removes-main-menu/#post-4968749)
 * the ‘menu’ is also a post type;
    [http://codex.wordpress.org/Post_Types](http://codex.wordpress.org/Post_Types)
 * try to check for the main query (untested):
 *     ```
       if( ( is_tax() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) && ! $query->is_main_query() ) {
       ```
   
 * [http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts](http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts)
 *  Thread Starter [compositeone](https://wordpress.org/support/users/compositeone/)
 * (@compositeone)
 * [12 years ago](https://wordpress.org/support/topic/function-removes-main-menu/#post-4968821)
 * Thanks for the suggestion. Turns out it was a WP3.0 fix in the theme template
   that was screwing things up.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Function removes main menu’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [compositeone](https://wordpress.org/support/users/compositeone/)
 * Last activity: [12 years ago](https://wordpress.org/support/topic/function-removes-main-menu/#post-4968821)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
