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:
Peter Westwood 2010-05-16 20:47:18 +00:00
parent 8d94af2efd
commit fd4a9ffa86
1 changed files with 2 additions and 2 deletions

View File

@ -181,8 +181,8 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
}
} elseif ( is_single() && strpos($wp_rewrite->permalink_structure, '%category%') !== false ) {
$category = get_term_by('slug', get_query_var('category_name'), 'category');
$post_terms = wp_get_object_terms($wp_query->get_queried_object_id(), 'category');
if ( (!$category || is_wp_error($category)) || ( !is_wp_error($post_terms) && !empty($post_terms) && !in_array($category, $post_terms) ) )
$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->term_taxonomy_id, $post_terms) ) )
$redirect_url = get_permalink($wp_query->get_queried_object_id());
}