diff --git a/src/wp-admin/includes/post.php b/src/wp-admin/includes/post.php index d3c7a7c12e..ae881e3795 100644 --- a/src/wp-admin/includes/post.php +++ b/src/wp-admin/includes/post.php @@ -1194,10 +1194,20 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { if ( false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%') ) { $return = '' . __('Permalink:') . "\n" . '' . $permalink . "\n"; - if ( '' == get_option( 'permalink_structure' ) && current_user_can( 'manage_options' ) && !( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) ) + if ( '' == get_option( 'permalink_structure' ) && current_user_can( 'manage_options' ) && !( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) ) { $return .= '' . __('Change Permalinks') . "\n"; - if ( isset( $view_post ) ) - $return .= "$view_post\n"; + } + + if ( isset( $view_post ) ) { + if( 'draft' == $post->post_status ) { + $preview_link = set_url_scheme( get_permalink( $post->ID ) ); + /** This filter is documented in wp-admin/includes/meta-boxes.php */ + $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ) ); + $return .= "$view_post\n"; + } else { + $return .= "$view_post\n"; + } + } /** * Filter the sample permalink HTML markup.