From cf6ce55d5147994836efaf18c10c7e1769c489c8 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Wed, 2 May 2012 17:39:43 +0000 Subject: [PATCH] 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: https://develop.svn.wordpress.org/trunk@20688 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/canonical.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wp-includes/canonical.php b/wp-includes/canonical.php index 94f8c0f2ff..683c1479a8 100644 --- a/wp-includes/canonical.php +++ b/wp-includes/canonical.php @@ -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 ( 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') ) $where .= $wpdb->prepare(" AND YEAR(post_date) = %d", get_query_var('year')); if ( get_query_var('monthnum') )