mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 07:40:07 +00:00
Create correct permalinks for child posts of hierarchical post types when default permalinks are used.
props loushou. fixes #29615 for trunk. git-svn-id: https://develop.svn.wordpress.org/trunk@29765 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -651,4 +651,28 @@ class Tests_Query_Results extends WP_UnitTestCase {
|
||||
$this->assertCount( 1, $result );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 29615
|
||||
*/
|
||||
function test_child_post_in_hierarchical_post_type_with_default_permalinks() {
|
||||
global $wp_rewrite;
|
||||
|
||||
$old_permastruct = get_option( 'permalink_structure' );
|
||||
$wp_rewrite->set_permalink_structure( '' );
|
||||
$wp_rewrite->flush_rules();
|
||||
|
||||
register_post_type( 'handbook', array( 'hierarchical' => true ) );
|
||||
|
||||
$post_1 = $this->factory->post->create( array( 'post_title' => 'Contributing to the WordPress Codex', 'post_type' => 'handbook' ) );
|
||||
$post_2 = $this->factory->post->create( array( 'post_title' => 'Getting Started', 'post_parent' => $post_1, 'post_type' => 'handbook' ) );
|
||||
|
||||
$this->assertContains( 'contributing-to-the-wordpress-codex/getting-started', get_permalink( $post_2 ) );
|
||||
|
||||
$result = $this->q->query( array( 'handbook' => 'contributing-to-the-wordpress-codex/getting-started', 'post_type' => 'handbook' ) );
|
||||
$this->assertCount( 1, $result );
|
||||
|
||||
$wp_rewrite->set_permalink_structure( $old_permastruct );
|
||||
$wp_rewrite->flush_rules();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user