title: Wordpress custom post type rewrite rule matches all pages
body: <p>I've created a custom post type with a rewrite to use the grandparent relationship as the URL like so: </p>
  
  <pre><code>function cpt_child(){
   $args = array(
    //code
    'rewrite' =&gt; array( 'slug' =&gt; '%grandparent%/%parent%', 'with_front' =&gt; false),
   );
   register_post_type( 'child', $args );
  }
  add_action( 'init', 'cpt_child' );
  </code></pre>
  
  <p>Then I update the permalink:</p>
  
  <pre><code>add_filter( 'post_type_link', 'filter_the_post_type_link', 1, 2 );
  function filter_the_post_type_link( $post_link, $post ) {
    switch( $post-&gt;post_type ) {
      case 'child':
              $post_link = get_bloginfo( 'url' );
              $relationship_child = p2p_type('children_to_parents')-&gt;get_adjacent_items($post-&gt;ID);
              $parent = $relationship['parent']-&gt;post_name;
              $relationship_parent = p2p_type('parents_to_grandparents')-&gt;get_adjacent_items($parent['parent']-&gt;ID);
              $grandparent = $relationship_parent['parent']-&gt;post_name;
              $post_link .= "/{$grandparent}/";
              $post_link .= "{$parent}/";
              $post_link .= "{$post-&gt;post_name}";
      break;
    }
    return $post_link;
  }
  </code></pre>
  
  <p>This all works great, but unfortunately the rewrite rule matches regular pages as well which makes them 404.</p>
  
  <p>I can prevent this by adding a custom slug, for example 'relationship': <code>http://example.com/relationship/grandparent/parent/child</code></p>
  
  <p>But I'd really like to use <code>http://example.com/grandparent/parent/child</code> and have it not break regular pages.</p>
  
  <p>I might have to resort to using non native Wordpress rewrites using htaccess.</p>
  
  <p>Thanks in advance!</p>