Switch to checking on tt_ids for the category lookup to ensure in_array call is PHP4 compatible. See #13410
git-svn-id: https://develop.svn.wordpress.org/trunk@14696 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8d94af2efd
commit
fd4a9ffa86
@ -181,8 +181,8 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
|
|||||||
}
|
}
|
||||||
} elseif ( is_single() && strpos($wp_rewrite->permalink_structure, '%category%') !== false ) {
|
} elseif ( is_single() && strpos($wp_rewrite->permalink_structure, '%category%') !== false ) {
|
||||||
$category = get_term_by('slug', get_query_var('category_name'), 'category');
|
$category = get_term_by('slug', get_query_var('category_name'), 'category');
|
||||||
$post_terms = wp_get_object_terms($wp_query->get_queried_object_id(), 'category');
|
$post_terms = wp_get_object_terms($wp_query->get_queried_object_id(), 'category', array('fields' => 'tt_ids'));
|
||||||
if ( (!$category || is_wp_error($category)) || ( !is_wp_error($post_terms) && !empty($post_terms) && !in_array($category, $post_terms) ) )
|
if ( (!$category || is_wp_error($category)) || ( !is_wp_error($post_terms) && !empty($post_terms) && !in_array($category->term_taxonomy_id, $post_terms) ) )
|
||||||
$redirect_url = get_permalink($wp_query->get_queried_object_id());
|
$redirect_url = get_permalink($wp_query->get_queried_object_id());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user