wp_count_terms

Advertisement

Summery Summery

Count how many terms are in Taxonomy.

Syntax Syntax

wp_count_terms( string $taxonomy, array|string $args = array() )

Description Description

Default $args is ‘hide_empty’ which can be ‘hide_empty=true’ or array(‘hide_empty’ => true).

Parameters Parameters

$taxonomy

(Required) Taxonomy name.

$args

(Optional) Array of arguments that get passed to get_terms().

Default value: array()

Return Return

(array|int|WP_Error) Number of terms in that taxonomy or WP_Error if the taxonomy does not exist.

Source Source

File: wp-includes/taxonomy.php

		 * Filters the term field sanitized for display.
		 *
		 * The dynamic portion of the filter name, `$field`, refers to the term field name.
		 *
		 * @since 2.3.0
		 *
		 * @param mixed  $value    Value of the term field.
		 * @param int    $term_id  Term ID.
		 * @param string $taxonomy Taxonomy slug.
		 * @param string $context  Context to retrieve the term field value.
		 */
		$value = apply_filters( "term_{$field}", $value, $term_id, $taxonomy, $context );

		/**
		 * Filters the taxonomy field sanitized for display.
		 *
		 * The dynamic portions of the filter name, `$taxonomy`, and `$field`, refer

Advertisement

Changelog Changelog

Changelog
Version Description
2.3.0 Introduced.

Advertisement

Leave a Reply