Make WordPress Core

Ticket #37423: 37423.diff

File 37423.diff, 1016 bytes (added by knutsp, 8 years ago)

Makes the actual sample permalink for pending posts valid as preview link

  • src/wp-admin/includes/post.php

     
    13001300        $preview_target = '';
    13011301
    13021302        if ( current_user_can( 'read_post', $post->ID ) ) {
    1303                 if ( 'draft' === $post->post_status ) {
     1303                if ( 'draft' === $post->post_status || empty( $post->post_name ) ) {
    13041304                        $view_link = get_preview_post_link( $post );
    13051305                        $preview_target = " target='wp-preview-{$post->ID}'";
    13061306                } else {
     
    13071307                        if ( 'publish' === $post->post_status || 'attachment' === $post->post_type ) {
    13081308                                $view_link = get_permalink( $post );
    13091309                        } else {
    1310                                 // Allow non-published (private, future) to be viewed at a pretty permalink.
     1310                                // Allow non-published (private, future) to be viewed at a pretty permalink, in case $post->post_name is set
    13111311                                $view_link = str_replace( array( '%pagename%', '%postname%' ), $post->post_name, $permalink );
    13121312                        }
    13131313                }