+ }
+
+ // If we're not in wp-admin and the post has been published and preview nonce
+ // is non-existent or invalid then no need for preview in query
+ if ( is_preview() && get_query_var( 'p' ) && 'publish' == get_post_status( get_query_var( 'p' ) ) ) {
+ if ( ! isset( $_GET['preview_id'] )
+ || ! isset( $_GET['preview_nonce'] )
+ || ! wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . (int) $_GET['preview_id'] ) ) {
+ $wp_query->is_preview = false;
+ }
+ }
+
+ if ( is_trackback() || is_search() || is_comments_popup() || is_admin() || is_preview() || is_robots() || ( $is_IIS && !iis7_supports_permalinks() ) ) {
+ return;
+ }