mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-06 07:36:58 +00:00
Prevent multiple hierarchical posts with the same slug from being displayed in single post template.
fixes #28611. git-svn-id: https://develop.svn.wordpress.org/trunk@28803 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -636,4 +636,19 @@ class Tests_Query_Results extends WP_UnitTestCase {
|
||||
$result11 = $this->q->query( array_merge( $args, array( 'post_password' => 'burrito' ) ) );
|
||||
$this->assertEqualSets( array( $two, $three ), $result11 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 28611
|
||||
*/
|
||||
function test_duplicate_slug_in_hierarchical_post_type() {
|
||||
register_post_type( 'handbook', array( 'hierarchical' => true ) );
|
||||
|
||||
$post_1 = $this->factory->post->create( array( 'post_title' => 'Getting Started', 'post_type' => 'handbook' ) );
|
||||
$post_2 = $this->factory->post->create( array( 'post_title' => 'Contributing to the WordPress Codex', 'post_type' => 'handbook' ) );
|
||||
$post_3 = $this->factory->post->create( array( 'post_title' => 'Getting Started', 'post_parent' => $post_2, 'post_type' => 'handbook' ) );
|
||||
|
||||
$result = $this->q->query( array( 'handbook' => 'getting-started', 'post_type' => 'handbook' ) );
|
||||
$this->assertEquals( 1, $this->q->post_count );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user