title: Wordpress - Custom post type archive page
body: <p>I created a custom post type using the Custom Post Type UI Plugin and made it support archives.  I have a CPT called Listing.  I am using the following function to have all the pages default to my CPT.  Everything works great except the the www.myURL.com/category page, which displays a 404 Error.<br>
  I'd like this page to display all the posts that exist as part of this CPT.</p>
  
  <pre><code>add_filter('pre_get_posts', 'query_post_type');
  
  function query_post_type($query) {
    if(is_category() || is_tag() &amp;&amp; empty( $query-&gt;query_vars['suppress_filters'] ) ) {
      $post_type = get_query_var('post_type');
       if($post_type) {
  
      $post_type = $post_type; //print 'test';
  }
  else {
      $post_type = array('post','listing', 'nav_menu_item');  //print '2nd';
      $query-&gt;set('post_type',$post_type);
      return $query;
      }
     }
  }
  </code></pre>