Function Reference: gd_get_terms
Summary
Get terms with term count.
Package
GeoDirectory_Location_Manager
Parameters
- $arr
- (array) (required) Term array.
- Default: None
- $tax
- (string) (required) Taxonomy name.
- Default: None
- $args
- (array) (required) GD args.
- Default: None
Return Values
- (mixed)
Change Log
Since: 1.0.0
Filters
‘geodir_loc_term_count’ [Line: 348]
Source File
gd_get_terms() is located in geodir_location_manager/geodir_count_functions.php [Line: 332]
Source Code
function gd_get_terms($arr,$tax,$args){
if(isset($args['gd_no_loop'])){return $arr;}// so we don't do an infinit loop
if(!empty($arr)){
$term_count = geodir_get_loc_term_count('term_count');
/**
* Filter the terms count by location.
*
* @since 1.3.4
*
* @param array $terms_count Array of term count row.
* @param array $terms Array of terms.
*/
$term_count = apply_filters( 'geodir_loc_term_count', $term_count, $arr );
foreach ($arr as $term) {
if (isset($term->term_id) && isset($term_count[$term->term_id])) {
$term->count = $term_count[$term->term_id];
}
}
}
return $arr;
}