Ticket #19241: 19241.check-category_name.diff
File 19241.check-category_name.diff, 1.1 KB (added by , 13 years ago) |
---|
-
wp-includes/canonical.php
191 191 } 192 192 193 193 } 194 } elseif ( is_single() && strpos($wp_rewrite->permalink_structure, '%category%') !== false ) {195 $category = get_category_by_path( get_query_var('category_name'));194 } elseif ( is_single() && strpos($wp_rewrite->permalink_structure, '%category%') !== false && $cat = get_query_var( 'category_name' ) ) { 195 $category = get_category_by_path( $cat ); 196 196 $post_terms = wp_get_object_terms($wp_query->get_queried_object_id(), 'category', array('fields' => 'tt_ids')); 197 197 if ( (!$category || is_wp_error($category)) || ( !is_wp_error($post_terms) && !empty($post_terms) && !in_array($category->term_taxonomy_id, $post_terms) ) ) 198 198 $redirect_url = get_permalink($wp_query->get_queried_object_id()); … … 494 494 } 495 495 } 496 496 497 add_action( 'template_redirect', 'wp_redirect_admin_locations', 1000 ); 498 No newline at end of file 497 add_action( 'template_redirect', 'wp_redirect_admin_locations', 1000 );