Only look for public post types in redirect_guess_404_permalink() when no post type query var is present. props jeremyfelt. fixes #19693.

git-svn-id: http://core.svn.wordpress.org/trunk@20688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2012-05-02 17:39:43 +00:00
parent d74bcb4a14
commit 4144452598
1 changed files with 3 additions and 0 deletions

View File

@ -492,6 +492,9 @@ function redirect_guess_404_permalink( $current_url = '' ) {
// if any of post_type, year, monthnum, or day are set, use them to refine the query // if any of post_type, year, monthnum, or day are set, use them to refine the query
if ( get_query_var('post_type') ) if ( get_query_var('post_type') )
$where .= $wpdb->prepare(" AND post_type = %s", get_query_var('post_type')); $where .= $wpdb->prepare(" AND post_type = %s", get_query_var('post_type'));
else
$where .= " AND post_type IN ('" . implode( "', '", get_post_types( array( 'public' => true ) ) ) . "')";
if ( get_query_var('year') ) if ( get_query_var('year') )
$where .= $wpdb->prepare(" AND YEAR(post_date) = %d", get_query_var('year')); $where .= $wpdb->prepare(" AND YEAR(post_date) = %d", get_query_var('year'));
if ( get_query_var('monthnum') ) if ( get_query_var('monthnum') )