From 47426465ed5969f8ec50f099a79f1d5e5e6034d8 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Sun, 14 Mar 2010 05:06:47 +0000 Subject: [PATCH] Limit redirect_guess_404_permalink() to the same post_type if it's specified in the query. See #12601 git-svn-id: https://develop.svn.wordpress.org/trunk@13697 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/canonical.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wp-includes/canonical.php b/wp-includes/canonical.php index 459b02c6b6..25d9bef5d5 100644 --- a/wp-includes/canonical.php +++ b/wp-includes/canonical.php @@ -362,7 +362,9 @@ function redirect_guess_404_permalink() { $where = $wpdb->prepare("post_name LIKE %s", get_query_var('name') . '%'); - // if any of 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') ) + $where .= $wpdb->prepare(" AND post_type = %s", get_query_var('post_type')); if ( get_query_var('year') ) $where .= $wpdb->prepare(" AND YEAR(post_date) = %d", get_query_var('year')); if ( get_query_var('monthnum') )