Create correct permalinks for child posts of hierarchical post types when default permalinks are used.
props loushou. fixes #29615 for trunk. Built from https://develop.svn.wordpress.org/trunk@29765 git-svn-id: http://core.svn.wordpress.org/trunk@29537 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
10e0807cce
commit
8889ba6a68
|
@ -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