From 1fd6c87716e438a35c206e0ff272814e19239adc Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Sat, 27 Jul 2013 06:57:42 +0000 Subject: [PATCH] Don't show "Preview" for locked, non-public post types. props aaroncampbell. fixed #24139. git-svn-id: https://develop.svn.wordpress.org/trunk@24799 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/post.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index be3cf55bf3..77fcc5cda8 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -1213,7 +1213,7 @@ function _admin_notice_post_locked() { $locked = false; } - if ( $locked && ( $sendback = wp_get_referer() ) && + if ( $locked && ( $sendback = wp_get_referer() ) && false === strpos( $sendback, 'post.php' ) && false === strpos( $sendback, 'post-new.php' ) ) { $sendback_text = __('Go back'); @@ -1235,12 +1235,16 @@ function _admin_notice_post_locked() { ID ) ) ); + if ( get_post_type_object( $post->post_type )->public ) { + $preview_link = set_url_scheme( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ); - if ( 'publish' == $post->post_status || $user->ID != $post->post_author ) { - // Latest content is in autosave - $nonce = wp_create_nonce( 'post_preview_' . $post->ID ); - $preview_link = add_query_arg( array( 'preview_id' => $post->ID, 'preview_nonce' => $nonce ), $preview_link ); + if ( 'publish' == $post->post_status || $user->ID != $post->post_author ) { + // Latest content is in autosave + $nonce = wp_create_nonce( 'post_preview_' . $post->ID ); + $preview_link = add_query_arg( array( 'preview_id' => $post->ID, 'preview_nonce' => $nonce ), $preview_link ); + } + } else { + $preview_link = ''; } $preview_link = apply_filters( 'preview_post_link', $preview_link ); @@ -1254,8 +1258,10 @@ function _admin_notice_post_locked() {

+