Fix guid generation for page auto drafts. Props shawnparker. fixes #15041

git-svn-id: http://svn.automattic.com/wordpress/trunk@17061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-12-19 14:42:17 +00:00
parent f2440caf0a
commit 93607280e6
1 changed files with 7 additions and 3 deletions

View File

@ -271,11 +271,15 @@ function _get_page_link( $id = false, $leavename = false, $sample = false ) {
else
$post = &get_post($id);
$draft_or_pending = in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft' ) );
$link = $wp_rewrite->get_page_permastruct();
if ( '' != $link && ( ( isset($post->post_status) && 'draft' != $post->post_status && 'pending' != $post->post_status ) || $sample ) ) {
if ( ! $leavename )
if ( !empty($link) && ( ( isset($post->post_status) && !$draft_or_pending ) || $sample ) ) {
if ( ! $leavename ) {
$link = str_replace('%pagename%', get_page_uri($id), $link);
}
$link = home_url($link);
$link = user_trailingslashit($link, 'page');
} else {