Limit redirect_guess_404_permalink() to the same post_type if it's specified in the query. See #12601
git-svn-id: http://svn.automattic.com/wordpress/trunk@13697 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4ebde35485
commit
9b0e7e79d0
|
@ -362,7 +362,9 @@ function redirect_guess_404_permalink() {
|
||||||
|
|
||||||
$where = $wpdb->prepare("post_name LIKE %s", get_query_var('name') . '%');
|
$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') )
|
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') )
|
||||||
|
|
Loading…
Reference in New Issue