Permalinks: Ensure Pending Review Posts permalink posts link to the draft

[34670] made the displayed permalink clickable. For posts that were pending review, the permalink wasn't being properly generated so the link wouldn't go to the preview.

Props knutsp, enshrined.
Fixes #37423.


Built from https://develop.svn.wordpress.org/trunk@38572


git-svn-id: http://core.svn.wordpress.org/trunk@38515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Aaron Jorbin 2016-09-08 04:05:31 +00:00
parent 5a632be944
commit 7e811d7120
2 changed files with 3 additions and 3 deletions

View File

@ -1300,14 +1300,14 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
$preview_target = '';
if ( current_user_can( 'read_post', $post->ID ) ) {
if ( 'draft' === $post->post_status ) {
if ( 'draft' === $post->post_status || empty( $post->post_name ) ) {
$view_link = get_preview_post_link( $post );
$preview_target = " target='wp-preview-{$post->ID}'";
} else {
if ( 'publish' === $post->post_status || 'attachment' === $post->post_type ) {
$view_link = get_permalink( $post );
} else {
// Allow non-published (private, future) to be viewed at a pretty permalink.
// Allow non-published (private, future) to be viewed at a pretty permalink, in case $post->post_name is set
$view_link = str_replace( array( '%pagename%', '%postname%' ), $post->post_name, $permalink );
}
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.7-alpha-38571';
$wp_version = '4.7-alpha-38572';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.