Use `reset()` to grab the first taxonomy in an array, not by numerical index. Cleans up whitespace. Props webord, nbachiyski. Fixes #23506.
git-svn-id: https://develop.svn.wordpress.org/trunk@25108 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
961bbcb780
commit
46c24c3cf2
|
@ -1235,13 +1235,13 @@ function get_terms($taxonomies, $args = '') {
|
|||
extract($args, EXTR_SKIP);
|
||||
|
||||
if ( $child_of ) {
|
||||
$hierarchy = _get_term_hierarchy($taxonomies[0]);
|
||||
$hierarchy = _get_term_hierarchy( reset( $taxonomies ) );
|
||||
if ( ! isset( $hierarchy[ $child_of ] ) )
|
||||
return $empty_array;
|
||||
}
|
||||
|
||||
if ( $parent ) {
|
||||
$hierarchy = _get_term_hierarchy($taxonomies[0]);
|
||||
$hierarchy = _get_term_hierarchy( reset( $taxonomies ) );
|
||||
if ( ! isset( $hierarchy[ $parent ] ) )
|
||||
return $empty_array;
|
||||
}
|
||||
|
@ -1310,7 +1310,7 @@ function get_terms($taxonomies, $args = '') {
|
|||
if ( ! empty( $exclude_tree ) ) {
|
||||
$excluded_trunks = wp_parse_id_list( $exclude_tree );
|
||||
foreach ( $excluded_trunks as $extrunk ) {
|
||||
$excluded_children = (array) get_terms($taxonomies[0], array('child_of' => intval($extrunk), 'fields' => 'ids', 'hide_empty' => 0));
|
||||
$excluded_children = (array) get_terms( reset( $taxonomies ), array( 'child_of' => intval( $extrunk ), 'fields' => 'ids', 'hide_empty' => 0 ) );
|
||||
$excluded_children[] = $extrunk;
|
||||
foreach( $excluded_children as $exterm ) {
|
||||
if ( empty( $exclusions ) )
|
||||
|
@ -1419,20 +1419,20 @@ function get_terms($taxonomies, $args = '') {
|
|||
}
|
||||
|
||||
if ( $child_of ) {
|
||||
$children = _get_term_hierarchy($taxonomies[0]);
|
||||
$children = _get_term_hierarchy( reset( $taxonomies ) );
|
||||
if ( ! empty( $children ) )
|
||||
$terms = _get_term_children($child_of, $terms, $taxonomies[0]);
|
||||
$terms = _get_term_children( $child_of, $terms, reset( $taxonomies ) );
|
||||
}
|
||||
|
||||
// Update term counts to include children.
|
||||
if ( $pad_counts && 'all' == $fields )
|
||||
_pad_term_counts($terms, $taxonomies[0]);
|
||||
_pad_term_counts( $terms, reset( $taxonomies ) );
|
||||
|
||||
// Make sure we show empty categories that have children.
|
||||
if ( $hierarchical && $hide_empty && is_array( $terms ) ) {
|
||||
foreach ( $terms as $k => $term ) {
|
||||
if ( ! $term->count ) {
|
||||
$children = _get_term_children($term->term_id, $terms, $taxonomies[0]);
|
||||
$children = _get_term_children( $term->term_id, $terms, reset( $taxonomies ) );
|
||||
if ( is_array( $children ) )
|
||||
foreach ( $children as $child )
|
||||
if ( $child->count )
|
||||
|
|
Loading…
Reference in New Issue