WordPress.org

Make WordPress Core

Ticket #15041: page-auto-draft-fix.diff

File page-auto-draft-fix.diff, 925 bytes (added by shawnparker, 8 years ago)

REVISED auto draft fix for pages

  • wp-includes/link-template.php

     
    271276        else
    272277                $post = &get_post($id);
    273278
     279        $draft_or_pending = in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft' ) );
     280
    274281        $link = $wp_rewrite->get_page_permastruct();
     282               
     283        if ( !empty($post_link) && ( ( isset($post->post_status) && !$draft_or_pending ) || $sample ) ) {       
     284                if ( ! $leavename ) {
     285                        $link = str_replace('%pagename%', get_page_uri($id), $link);
     286                }
    275287
    276         if ( '' != $link && ( ( isset($post->post_status) && 'draft' != $post->post_status && 'pending' != $post->post_status ) || $sample ) ) {
    277                 if ( ! $leavename )
    278                         $link = str_replace('%pagename%', get_page_uri($id), $link);
    279288                $link = home_url($link);
    280289                $link = user_trailingslashit($link, 'page');
    281290        } else {