From a282f7b3258b018267f0883a8d5a7d7da4f7ff43 Mon Sep 17 00:00:00 2001 From: szk11001 Date: Mon, 9 Nov 2015 11:33:19 -0500 Subject: [PATCH] Fix for tags not working when grouping Previously, tags weren't working properly when breaking into groups --- uc-people-widget.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/uc-people-widget.php b/uc-people-widget.php index e33a72b..ede4233 100644 --- a/uc-people-widget.php +++ b/uc-people-widget.php @@ -165,20 +165,26 @@ Class UC_People_Widget extends WP_Widget { if ( $settings['specific_groups'] != false || $settings['specific_tags'] != false ){ $tax_query = array(); + $isGroupSet = false; + $isTagSet = false; if ( $settings['specific_groups'] != false ) { - $tax_query[] = array( + $isGroupSet = true; + $taxGroupArray = array( 'taxonomy' => 'group', 'field' => 'term_id', 'terms' => $settings['specific_groups'] ); + $tax_query[] = $taxGroupArray; } if ( $settings['specific_tags'] != false ) { - $tax_query[] = array( + $isTagSet = true; + $taxTagArray = array( 'taxonomy' => 'persontag', 'field' => 'term_id', 'terms' => $settings['specific_tags'] ); + $tax_query[] = $taxTagArray; } $wpQueryArgs['tax_query'] = $tax_query; } @@ -220,6 +226,12 @@ Class UC_People_Widget extends WP_Widget { 'terms' => $value ); array_push($tax_query, $group_query); + /*if( $isGroupSet != false ){ + array_push($tax_query, $taxGroupArray); + }*/ + if( $isTagSet != false ){ + array_push($tax_query, $taxTagArray); + } $wpQueryArgs['tax_query'] = $tax_query; // with $arg updated, let's do a new query.