Ticket #11823: 11823.2.diff
File 11823.2.diff, 2.8 KB (added by , 11 years ago) |
---|
-
src/wp-includes/taxonomy.php
1290 1290 1291 1291 $where = "tt.taxonomy IN ('" . implode("', '", $taxonomies) . "')"; 1292 1292 $inclusions = ''; 1293 if ( ! empty($include) ) {1293 if ( ! empty( $include ) ) { 1294 1294 $exclude = ''; 1295 1295 $exclude_tree = ''; 1296 $interms = wp_parse_id_list($include); 1297 foreach ( $interms as $interm ) { 1298 if ( empty($inclusions) ) 1299 $inclusions = ' AND ( t.term_id = ' . intval($interm) . ' '; 1300 else 1301 $inclusions .= ' OR t.term_id = ' . intval($interm) . ' '; 1302 } 1296 $inclusions = implode( ',', array_map( 'intval', wp_parse_id_list( $include ) ) ); 1303 1297 } 1304 1298 1305 if ( ! empty($inclusions) )1306 $inclusions .= ')';1299 if ( ! empty( $inclusions ) ) 1300 $inclusions = ' AND t.term_id IN ( ' . $inclusions . ' )'; 1307 1301 $where .= $inclusions; 1308 1302 1309 1303 $exclusions = ''; 1310 if ( !empty( $exclude_tree ) ) { 1311 $excluded_trunks = wp_parse_id_list($exclude_tree); 1312 foreach ( $excluded_trunks as $extrunk ) { 1313 $excluded_children = (array) get_terms($taxonomies[0], array('child_of' => intval($extrunk), 'fields' => 'ids', 'hide_empty' => 0)); 1304 if ( ! empty( $exclude_tree ) ) { 1305 $exclude_tree = wp_parse_id_list( $exclude_tree ); 1306 $excluded_children = array(); 1307 foreach ( $exclude_tree as $extrunk ) { 1308 $excluded_children = array_merge( 1309 $excluded_children, 1310 (array) get_terms( $taxonomies[0], array( 'child_of' => intval( $extrunk ), 'fields' => 'ids', 'hide_empty' => 0 ) ) 1311 ); 1314 1312 $excluded_children[] = $extrunk; 1315 foreach( $excluded_children as $exterm ) {1316 if ( empty($exclusions) )1317 $exclusions = ' AND ( t.term_id <> ' . intval($exterm) . ' ';1318 else1319 $exclusions .= ' AND t.term_id <> ' . intval($exterm) . ' ';1320 }1321 1313 } 1314 $exclusions = implode( ',', array_map( 'intval', $excluded_children ) ); 1322 1315 } 1323 1316 1324 if ( !empty($exclude) ) { 1325 $exterms = wp_parse_id_list($exclude); 1326 foreach ( $exterms as $exterm ) { 1327 if ( empty($exclusions) ) 1328 $exclusions = ' AND ( t.term_id <> ' . intval($exterm) . ' '; 1329 else 1330 $exclusions .= ' AND t.term_id <> ' . intval($exterm) . ' '; 1331 } 1317 if ( ! empty( $exclude ) ) { 1318 $exterms = array_map( 'intval', wp_parse_id_list( $exclude ) ); 1319 if ( empty( $exclusions ) ) 1320 $exclusions = implode( ',', $exterms ); 1321 else 1322 $exclusions .= ', ' . implode( ',', $exterms ); 1332 1323 } 1333 1324 1334 if ( !empty($exclusions) ) 1335 $exclusions .= ')'; 1336 $exclusions = apply_filters('list_terms_exclusions', $exclusions, $args ); 1325 if ( ! empty( $exclusions ) ) 1326 $exclusions = ' AND t.term_id NOT IN (' . $exclusions . ')'; 1327 1328 $exclusions = apply_filters( 'list_terms_exclusions', $exclusions, $args ); 1337 1329 $where .= $exclusions; 1338 1330 1339 1331 if ( !empty($slug) ) {