Ticket #20496: preview-patch.diff
File preview-patch.diff, 1.5 KB (added by , 11 years ago) |
---|
-
wp-includes/canonical.php
39 39 function redirect_canonical( $requested_url = null, $do_redirect = true ) { 40 40 global $wp_rewrite, $is_IIS, $wp_query, $wpdb; 41 41 42 // If we're not in wp-admin and the post has been published and preview nonce 43 // is non-existant or invalid then no need for preview in query 44 if ( is_preview() && get_query_var( 'p' ) && 'publish' == get_post_status( get_query_var( 'p' ) ) ) { 45 if ( ! isset( $_GET['preview_id'] ) || ! isset( $_GET['preview_nonce'] ) || ! wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . intval( $_GET['preview_id'] ) ) ) 46 $wp_query->is_preview = false; 47 } 48 42 49 if ( is_trackback() || is_search() || is_comments_popup() || is_admin() || !empty($_POST) || is_preview() || is_robots() || ( $is_IIS && !iis7_supports_permalinks() ) ) 43 50 return; 44 51 … … 68 75 if ( !isset($redirect['query']) ) 69 76 $redirect['query'] = ''; 70 77 78 // If its not a preview then remove it from URL 79 if ( ! is_preview() ) 80 $redirect['query'] = remove_query_arg( 'preview', $redirect['query'] ); 81 71 82 if ( is_feed() && ( $id = get_query_var( 'p' ) ) ) { 72 83 if ( $redirect_url = get_post_comments_feed_link( $id, get_query_var( 'feed' ) ) ) { 73 84 $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type', 'feed'), $redirect_url );