Function Reference: geodir_filter_empty_terms

Summary

Filter the terms with count empty.

Parameters

$terms
(array) (required) Terms array.

Default: None

Return Values

(array)
  • Terms.

Change Log

Since: 1.5.4

Source File

geodir_filter_empty_terms() is located in geodirectory-functions/general_functions.php [Line: 5212]

Source Code

function geodir_filter_empty_terms( $terms ) {
	if ( empty( $terms ) ) {
		return $terms;
	}

	$return = array();
	foreach ( $terms as $term ) {
		if ( isset( $term->count ) && $term->count > 0 ) {
			$return[] = $term;
		} else {
			/**
			 * Allow to filter terms with no count.
			 *
			 * @since 1.6.6
			 *
			 * @param array $return The array of terms to return.
			 * @param object $term  The term object.
			 */
			$return = apply_filters( 'geodir_filter_empty_terms_filter', $return, $term );
		}
	}

	return $return;
}