diff --git wp-includes/taxonomy.php wp-includes/taxonomy.php
index 955369e..2393d8e 100644
|
|
function get_terms($taxonomies, $args = '') { |
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); |
| 1304 | if ( ! empty( $exclude_tree ) ) { |
| 1305 | $excluded_trunks = wp_parse_id_list( $exclude_tree ); |
1312 | 1306 | foreach ( $excluded_trunks as $extrunk ) { |
1313 | | $excluded_children = (array) get_terms($taxonomies[0], array('child_of' => intval($extrunk), 'fields' => 'ids', 'hide_empty' => 0)); |
| 1307 | $excluded_children = (array) get_terms( $taxonomies[0], array( 'child_of' => intval( $extrunk ), 'fields' => 'ids', 'hide_empty' => 0 ) ); |
1314 | 1308 | $excluded_children[] = $extrunk; |
1315 | | foreach( $excluded_children as $exterm ) { |
1316 | | if ( empty($exclusions) ) |
1317 | | $exclusions = ' AND ( t.term_id <> ' . intval($exterm) . ' '; |
1318 | | else |
1319 | | $exclusions .= ' AND t.term_id <> ' . intval($exterm) . ' '; |
1320 | | } |
| 1309 | $exclusions = implode( ',', array_map( 'intval', $excluded_children ) ); |
1321 | 1310 | } |
1322 | 1311 | } |
1323 | 1312 | |
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 | | } |
| 1313 | if ( ! empty( $exclude ) ) { |
| 1314 | $exterms = array_map( 'intval', wp_parse_id_list( $exclude ) ); |
| 1315 | if ( empty( $exclusions ) ) |
| 1316 | $exclusions = implode( ',', $exterms ); |
| 1317 | else |
| 1318 | $exclusions .= ', ' . implode( ',', $exterms ); |
1332 | 1319 | } |
1333 | 1320 | |
1334 | | if ( !empty($exclusions) ) |
1335 | | $exclusions .= ')'; |
1336 | | $exclusions = apply_filters('list_terms_exclusions', $exclusions, $args ); |
| 1321 | if ( ! empty( $exclusions ) ) |
| 1322 | $exclusions = ' AND t.term_id NOT IN (' . $exclusions . ')'; |
| 1323 | |
| 1324 | $exclusions = apply_filters( 'list_terms_exclusions', $exclusions, $args ); |
1337 | 1325 | $where .= $exclusions; |
1338 | 1326 | |
1339 | 1327 | if ( !empty($slug) ) { |