Ticket #17807: 17807.patch
File 17807.patch, 1.7 KB (added by , 13 years ago) |
---|
-
wp-includes/link-template.php
1104 1104 return null; 1105 1105 1106 1106 $current_post_date = $post->post_date; 1107 1108 if ( $in_same_cat && taxonomy_exists( $in_same_cat ) ) { 1109 $taxonomy = $in_same_cat; 1110 } else { 1111 $taxonomy = 'category'; 1112 } 1107 1113 1108 1114 $join = ''; 1109 1115 $posts_in_ex_cats_sql = ''; … … 1111 1117 $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"; 1112 1118 1113 1119 if ( $in_same_cat ) { 1114 $cat_array = wp_get_object_terms($post->ID, 'category', array('fields' => 'ids'));1115 $join .= " AND tt.taxonomy = ' category' AND tt.term_id IN (" . implode(',', $cat_array) . ")";1120 $cat_array = wp_get_object_terms($post->ID, $taxonomy, array('fields' => 'ids')); 1121 $join .= " AND tt.taxonomy = '" . $taxonomy ."' AND tt.term_id IN (" . implode(',', $cat_array) . ")"; 1116 1122 } 1117 1123 1118 $posts_in_ex_cats_sql = "AND tt.taxonomy = ' category'";1124 $posts_in_ex_cats_sql = "AND tt.taxonomy = '" . $taxonomy ."'"; 1119 1125 if ( !empty($excluded_categories) ) { 1120 1126 $excluded_categories = array_map('intval', explode(' and ', $excluded_categories)); 1121 1127 if ( !empty($cat_array) ) { … … 1124 1130 } 1125 1131 1126 1132 if ( !empty($excluded_categories) ) { 1127 $posts_in_ex_cats_sql = " AND tt.taxonomy = ' category' AND tt.term_id NOT IN (" . implode($excluded_categories, ',') . ')';1133 $posts_in_ex_cats_sql = " AND tt.taxonomy = '" . $taxonomy . "' AND tt.term_id NOT IN (" . implode($excluded_categories, ',') . ')'; 1128 1134 } 1129 1135 } 1130 1136 }