| | 221 | |
| | 222 | /** |
| | 223 | * @ticket 21970 |
| | 224 | */ |
| | 225 | function test_404_post_and_page_with_same_slug() { |
| | 226 | global $wp_rewrite, $template; |
| | 227 | $wp_rewrite->set_permalink_structure( '/%postname%/' ); |
| | 228 | $wp_rewrite->flush_rules(); |
| | 229 | $wp_rewrite->init(); |
| | 230 | |
| | 231 | // Create a page that we will trash |
| | 232 | $args = $this->factory->post->generate_args(); |
| | 233 | $args['post_type'] = 'page'; |
| | 234 | $page = $this->factory->post->create_and_get( $args ); |
| | 235 | |
| | 236 | // Create a post with the same slug than the page |
| | 237 | $args = $this->factory->post->generate_args(); |
| | 238 | $args['post_title'] = $page->post_title; |
| | 239 | $post = $this->factory->post->create_and_get( $args ); |
| | 240 | |
| | 241 | // Go to the post |
| | 242 | $this->go_to( get_permalink( $post ) ); |
| | 243 | |
| | 244 | // Make sure that is not a 404 |
| | 245 | $this->assertFalse( is_404() ); |
| | 246 | } |