Ticket #22360: 22360.patch
File 22360.patch, 936 bytes (added by , 12 years ago) |
---|
-
wp-includes/link-template.php
1132 1132 if ( $in_same_cat || ! empty( $excluded_categories ) ) { 1133 1133 $join = " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id"; 1134 1134 1135 if ( $in_same_cat ) {1135 if ( $in_same_cat && is_object_in_taxonomy( $post->post_type, 'category' ) ) { 1136 1136 $cat_array = wp_get_object_terms($post->ID, 'category', array('fields' => 'ids')); 1137 $join .= " AND tt.taxonomy = 'category' AND tt.term_id IN (" . implode(',', $cat_array) . ")"; 1137 if ( $cat_array ) 1138 $join .= " AND tt.taxonomy = 'category' AND tt.term_id IN (" . implode(',', $cat_array) . ")"; 1138 1139 } 1139 1140 1140 1141 $posts_in_ex_cats_sql = "AND tt.taxonomy = 'category'";