mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Switch to checking on tt_ids for the category lookup to ensure in_array call is PHP4 compatible. See #13410
git-svn-id: http://svn.automattic.com/wordpress/trunk@14696 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6881380fc0
commit
ba0ff79ca9
@ -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());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user