title: When I add custom post type permalink rewrite, my regular post permalinks stop working. Can't get both to work at the same time
body: <p>really struggling with this one, so any help would be much appreciated. My site has both regular post posts, and a custom post type called "articles." </p>
  
  <p>I'm trying to get it to work so that my regular posts will use the /%category%/postname%/ permalink structure, (which I have set up in settings). This is working fine, until I add a custom rewrite for my article post type. I'd like articles to follow a /%issue%/%postname%/ structure.  I can get this working great with the following: </p>
  
  <pre><code>add_filter( 'post_type_link', 'wpa_show_permalinks', 1, 2 );
  
  function wpa_show_permalinks( $post_link, $id = 0 ){
      $post = get_post($id);
      if ( is_object( $post ) &amp;&amp; $post-&gt;post_type == 'article' ){
          $terms = wp_get_object_terms( $post-&gt;ID, 'issue_tax' );
          if( $terms ){
              return str_replace( '%issue%' , $terms[0]-&gt;slug , $post_link );
          }
      }
      return $post_link;
  }
  </code></pre>
  
  <p>where my post type is registered like this: </p>
  
  <pre><code>function article_post_type() {
  
  $labels = array(
      'name'                =&gt; _x( 'Magazine Articles', 'Post Type General Name', 'text_domain' ),
      'singular_name'       =&gt; _x( 'Magazine Article', 'Post Type Singular Name', 'text_domain' ),
      'menu_name'           =&gt; __( 'Magazine Articles', 'text_domain' ),
      'name_admin_bar'      =&gt; __( 'Magazine Articles', 'text_domain' ),
      'parent_item_colon'   =&gt; __( 'Parent Article:', 'text_domain' ),
      'all_items'           =&gt; __( 'All Articles', 'text_domain' ),
      'add_new_item'        =&gt; __( 'Add New Article', 'text_domain' ),
      'add_new'             =&gt; __( 'Add New', 'text_domain' ),
      'new_item'            =&gt; __( 'New Article', 'text_domain' ),
      'edit_item'           =&gt; __( 'Edit Article', 'text_domain' ),
      'update_item'         =&gt; __( 'Update Article', 'text_domain' ),
      'view_item'           =&gt; __( 'View Article', 'text_domain' ),
      'search_items'        =&gt; __( 'Search Article', 'text_domain' ),
      'not_found'           =&gt; __( 'Not found', 'text_domain' ),
      'not_found_in_trash'  =&gt; __( 'Not found in Trash', 'text_domain' ),
  );
  $rewrite = array(
      'slug'                =&gt; '%issue%',
      'with_front'          =&gt; false,
      'pages'               =&gt; true,
      'feeds'               =&gt; true,
  );
  $args = array(
      'label'               =&gt; __( 'article', 'text_domain' ),
      'description'         =&gt; __( 'Magazine Articles and Features', 'text_domain' ),
      'labels'              =&gt; $labels,
      'supports'            =&gt; array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'trackbacks', 'revisions', 'custom-fields', 'page-attributes', ),
      'taxonomies'          =&gt; array( 'issue_tax', 'category', 'featured_media', 'tag' ),
      'hierarchical'        =&gt; false,
      'public'              =&gt; true,
      'show_ui'             =&gt; true,
      'show_in_menu'        =&gt; true,
      'menu_position'       =&gt; 5,
      'menu_icon'           =&gt; 'dashicons-welcome-write-blog',
      'show_in_admin_bar'   =&gt; true,
      'show_in_nav_menus'   =&gt; true,
      'can_export'          =&gt; true,
      'has_archive'         =&gt; true,
      'exclude_from_search' =&gt; false,
      'publicly_queryable'  =&gt; true,
      'rewrite'             =&gt; $rewrite,
      'capability_type'     =&gt; 'page',
  );
  register_post_type( 'article', $args );
  
  }
  
  
  add_action( 'init', 'article_post_type', 0 );
  </code></pre>
  
  <p>I add that, reset permalink settings, and the article permalinks start working as indended -  BUT  - as soon as I get that working, my regular posts start displaying a 404.  </p>
  
  <p>Why am I unable to get both to work at the same time? Am I missing a piece somewhere?</p>
  
  <p>Thanks for any advice!</p>
  
  <p>-erin</p>
  
  <hr>
  
  <p>Just a follow up to my question - perhaps the thing that I'm really struggling with is why is the post_type_filter function affecting more than just the article post type that I have specified?</p>
  
  <p>Thanks, 
  Erin</p>
  
  <hr>
  
  <p>Ok, one more super strange thing. This all works if I pass a query parameter at the end of my custom post links, so this works: <a href="http://www.mysitename.com/spring-2015/test-article-here/?post_type=article" rel="nofollow">http://www.mysitename.com/spring-2015/test-article-here/?post_type=article</a> but this gives me a 404 <a href="http://www.mysitename.com/spring-2015/test-article-here/" rel="nofollow">http://www.mysitename.com/spring-2015/test-article-here/</a></p>
  
  <p>Why would that be? I'm sorry for so many questions, just really trying to get to the bottom of this..!</p>
  
  <p>Thanks again, 
  Erin</p>