Show page hierarchy when editing page slugs. fixes #6068

git-svn-id: http://svn.automattic.com/wordpress/trunk@7133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-03-02 22:15:30 +00:00
parent bf8f7b0f28
commit bee4e17d23

View File

@ -593,7 +593,19 @@ function get_sample_permalink($id, $name = null) {
if (!is_null($name)) {
$post->post_name = sanitize_title($name, $post->ID);
}
$permalink = get_permalink($post, true);
// Handle page hierarchy
if ( 'page' == $post->post_type ) {
$uri = get_page_uri($post->ID);
$uri = str_replace($post->post_name, '', $uri);
$uri = untrailingslashit($uri);
if ( !empty($uri) )
$uri .='/';
$permalink = str_replace('%pagename%', "${uri}%pagename%", $permalink);
}
$permalink = array($permalink, $post->post_name);
$post->post_status = $original_status;
$post->post_date = $original_date;