Ticket #28611: 28611.patch
File 28611.patch, 2.0 KB (added by , 10 years ago) |
---|
-
src/wp-includes/query.php
2372 2372 if ( !$ptype_obj || !$ptype_obj->query_var || empty($q[ $ptype_obj->query_var ]) ) 2373 2373 continue; 2374 2374 2375 if ( ! $ptype_obj->hierarchical || strpos($q[ $ptype_obj->query_var ], '/') === false) {2376 // Non-hierarchical post _types & parent-level-hierarchical post_types can directly use 'name'2375 if ( ! $ptype_obj->hierarchical ) { 2376 // Non-hierarchical post types can directly use 'name'. 2377 2377 $q['name'] = $q[ $ptype_obj->query_var ]; 2378 2378 } else { 2379 // Hierarchical post _types will operate through the2379 // Hierarchical post types will operate through 'pagename'. 2380 2380 $q['pagename'] = $q[ $ptype_obj->query_var ]; 2381 2381 $q['name'] = ''; 2382 2382 } -
tests/phpunit/tests/query/results.php
636 636 $result11 = $this->q->query( array_merge( $args, array( 'post_password' => 'burrito' ) ) ); 637 637 $this->assertEqualSets( array( $two, $three ), $result11 ); 638 638 } 639 640 /** 641 * @ticket 28611 642 */ 643 function test_duplicate_slug_in_hierarchical_post_type() { 644 register_post_type( 'handbook', array( 'hierarchical' => true ) ); 645 646 $post_1 = $this->factory->post->create( array( 'post_title' => 'Getting Started', 'post_type' => 'handbook' ) ); 647 $post_2 = $this->factory->post->create( array( 'post_title' => 'Contributing to the WordPress Codex', 'post_type' => 'handbook' ) ); 648 $post_3 = $this->factory->post->create( array( 'post_title' => 'Getting Started', 'post_parent' => $post_2, 'post_type' => 'handbook' ) ); 649 650 $result = $this->q->query( array( 'handbook' => 'getting-started', 'post_type' => 'handbook' ) ); 651 $this->assertEquals( 1, $this->q->post_count ); 652 } 653 639 654 }