Changeset 37262
- Timestamp:
- 04/20/2016 03:34:15 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/canonical.php
r36237 r37262 257 257 } elseif ( is_single() && strpos($wp_rewrite->permalink_structure, '%category%') !== false && $cat = get_query_var( 'category_name' ) ) { 258 258 $category = get_category_by_path( $cat ); 259 $post_terms = wp_get_object_terms($wp_query->get_queried_object_id(), 'category', array('fields' => 'tt_ids'));260 if ( ( !$category || is_wp_error($category)) || ( !is_wp_error($post_terms) && !empty($post_terms) && !in_array($category->term_taxonomy_id, $post_terms) ) )259 $post_terms = get_the_terms( $wp_query->get_queried_object_id(), 'category' ); 260 if ( ( ! $category || is_wp_error( $category ) ) || ( ! is_wp_error( $post_terms ) && ! empty( $post_terms ) && ! in_array( $category, $post_terms ) ) ) { 261 261 $redirect_url = get_permalink($wp_query->get_queried_object_id()); 262 } 262 263 } 263 264
Note: See TracChangeset
for help on using the changeset viewer.