Create correct permalinks for child posts of hierarchical post types when default permalinks are used.
Merges [29765] to the 4.0 branch. props loushou. fixes #29615. Built from https://develop.svn.wordpress.org/branches/4.0@30260 git-svn-id: http://core.svn.wordpress.org/branches/4.0@30260 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7be0716c9f
commit
eec6b41e3d
|
@ -257,10 +257,12 @@ function get_post_permalink( $id = 0, $leavename = false, $sample = false ) {
|
|||
|
||||
$post_type = get_post_type_object($post->post_type);
|
||||
|
||||
if ( $post_type->hierarchical ) {
|
||||
$slug = get_page_uri( $id );
|
||||
}
|
||||
|
||||
if ( !empty($post_link) && ( !$draft_or_pending || $sample ) ) {
|
||||
if ( ! $leavename ) {
|
||||
if ( $post_type->hierarchical )
|
||||
$slug = get_page_uri($id);
|
||||
$post_link = str_replace("%$post->post_type%", $slug, $post_link);
|
||||
}
|
||||
$post_link = home_url( user_trailingslashit($post_link) );
|
||||
|
|
Loading…
Reference in New Issue