title: Custom Posts with same slug Redirecting to wrong post with same slug
body: <p>I have 2 Custom Post type posts.The video Post and City-guide Post
  The first Post(Video Post) contains the url: <a href="http://104.130.239.132/rick-owens/" rel="noreferrer">104.130.239.132/rick-owens/</a>  and the second Post(City-Guide Post) conatins url:<a href="http://104.130.239.132/city-guide/rick-owens/" rel="noreferrer">http://104.130.239.132/city-guide/rick-owens/</a>  (city-guide is the permalink structured which is the name of custom post type).
                                                                                 SO the issue arrise here whenever we try to access the first url it displays the template and content of 2nd url.The 2nd url is latest published.I tried from myself to solve by disabling the Yoast Seo Plugin still no change and also done my permalink refreshed still got same results.</p>
  
  <p>Attaching the Yoast SEO snippet for first url post: <a href="https://i.stack.imgur.com/9bwTz.png" rel="noreferrer"><img src="https://i.stack.imgur.com/9bwTz.png" alt="enter image description here"></a> and the Yoast SEO snippet of second url post <a href="https://i.stack.imgur.com/d5KRg.png" rel="noreferrer"><img src="https://i.stack.imgur.com/d5KRg.png" alt="enter image description here"></a>
  Any Help will be appreciated,Thanks.</p>
  
  <p>Addition:</p>
  
  <p>Here are my CPT codes.</p>
  
  <p>1.Video Posts :</p>
  
  <pre><code>$labels = array(
  'name'                =&gt; _x( 'Videos', 'Post Type General Name', 'roots' ),
  'singular_name'       =&gt; _x( 'Video', 'Post Type Singular Name', 'roots' ),
  'menu_name'           =&gt; __( 'Video Posts', 'roots' ),
  'parent_item_colon'   =&gt; __( 'Parent Video:', 'roots' ),
  'all_items'           =&gt; __( 'All Videos', 'roots' ),
  'view_item'           =&gt; __( 'View Video', 'roots' ),
  'add_new_item'        =&gt; __( 'Add New Video', 'roots' ),
  'add_new'             =&gt; __( 'Add New', 'roots' ),
  'edit_item'           =&gt; __( 'Edit Video', 'roots' ),
  'update_item'         =&gt; __( 'Update Video', 'roots' ),
  'search_items'        =&gt; __( 'Search Video', 'roots' ),
  'not_found'           =&gt; __( 'Not found', 'roots' ),
  'not_found_in_trash'  =&gt; __( 'Not found in Trash', 'roots' ),
  );
  $rewrite = array(
  'slug'                =&gt; 'rewrite',
  'with_front'          =&gt; true,
  'pages'               =&gt; true,
  'feeds'               =&gt; true,
  );
  $args = array(
  'label'               =&gt; __( 'video', 'roots' ),
  'description'         =&gt; __( 'Videos Post Type', 'roots' ),
  'labels'              =&gt; $labels,
  'supports'            =&gt; array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'trackbacks', 'revisions', 'custom-fields', ),
  'taxonomies'          =&gt; array( 'category', 'post_tag' ),
  'hierarchical'        =&gt; false,
  'public'              =&gt; true,
  'show_ui'             =&gt; true,
  'show_in_menu'        =&gt; true,
  'show_in_nav_menus'   =&gt; true,
  'show_in_admin_bar'   =&gt; true,
  'menu_position'       =&gt; 5,
  'can_export'          =&gt; true,
  'has_archive'         =&gt; true,
  'exclude_from_search' =&gt; false,
  'publicly_queryable'  =&gt; true,
  'rewrite'       =&gt; $rewrite,
  'capability_type'     =&gt; 'post',
  'yarpp_support'    =&gt; TRUE
  );
  register_post_type( 'video', $args );
  </code></pre>
  
  <p>2.City Guide Posts :</p>
  
  <pre><code>function register_post_types(){
  register_post_type( 'city-guide', [
  'has_archive' =&gt; TRUE,
  'hierarchical' =&gt; TRUE,
  'labels' =&gt; [
  'name' =&gt; 'City Guide'
  ],
  'public' =&gt; TRUE,
  'supports' =&gt; ['editor', 'page-attributes', 'revisions', 'thumbnail', 'title','custom-fields','excerpt'],
  'taxonomies' =&gt; array('post_tag')
  ] );
  add_image_size( 'ipad-city-thumb', 650, 650, TRUE );
  }
  add_action( 'init', __NAMESPACE__.'\register_post_types', 20 );
  </code></pre>
  
  <p>I have this then in my code </p>
  
  <pre><code>remove /rewrite/ slug from custom permalinks, to allow domain/slug for all post types
  public function post_link_rewrite( $post_link, $post, $leavename ){
        $post_link = str_replace( '/rewrite/', '/', $post_link );
  
        return $post_link;
      }
  </code></pre>