Ticket #24139: 24139.diff
File 24139.diff, 2.1 KB (added by , 11 years ago) |
---|
-
wp-admin/includes/post.php
1213 1213 $locked = false; 1214 1214 } 1215 1215 1216 if ( $locked && ( $sendback = wp_get_referer() ) && 1216 if ( $locked && ( $sendback = wp_get_referer() ) && 1217 1217 false === strpos( $sendback, 'post.php' ) && false === strpos( $sendback, 'post-new.php' ) ) { 1218 1218 1219 1219 $sendback_text = __('Go back'); … … 1235 1235 <?php 1236 1236 1237 1237 if ( $locked ) { 1238 $preview_link = set_url_scheme( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ); 1238 if ( get_post_type_object( $post->post_type )->publicly_queryable ) { 1239 $preview_link = set_url_scheme( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ); 1239 1240 1240 if ( 'publish' == $post->post_status || $user->ID != $post->post_author ) { 1241 // Latest content is in autosave 1242 $nonce = wp_create_nonce( 'post_preview_' . $post->ID ); 1243 $preview_link = add_query_arg( array( 'preview_id' => $post->ID, 'preview_nonce' => $nonce ), $preview_link ); 1241 if ( 'publish' == $post->post_status || $user->ID != $post->post_author ) { 1242 // Latest content is in autosave 1243 $nonce = wp_create_nonce( 'post_preview_' . $post->ID ); 1244 $preview_link = add_query_arg( array( 'preview_id' => $post->ID, 'preview_nonce' => $nonce ), $preview_link ); 1245 } 1246 1247 } else { 1248 $preview_link = ''; 1244 1249 } 1245 1246 1250 $preview_link = apply_filters( 'preview_post_link', $preview_link ); 1247 1251 $override = apply_filters( 'override_post_lock', true, $post, $user ); 1248 1252 $tab_last = $override ? '' : ' wp-tab-last'; … … 1254 1258 <?php do_action( 'post_lock_text', $post ); ?> 1255 1259 <p> 1256 1260 <a class="button" href="<?php echo esc_url( $sendback ); ?>"><?php echo $sendback_text; ?></a> 1261 <?php if ( ! empty( $preview_link ) ) { ?> 1257 1262 <a class="button<?php echo $tab_last; ?>" href="<?php echo esc_url( $preview_link ); ?>"><?php _e('Preview'); ?></a> 1258 1263 <?php 1264 } 1259 1265 1260 1266 // Allow plugins to prevent some users overriding the post lock 1261 1267 if ( $override ) {