Changeset 48840 for trunk/src/wp-includes/taxonomy.php
- Timestamp:
- 08/21/2020 10:30:06 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/taxonomy.php
r48782 r48840 1731 1731 * 1732 1732 * @since 2.3.0 1733 * 1734 * @param string $taxonomy Taxonomy name. 1735 * @param array|string $args Optional. Array of arguments that get passed to get_terms(). 1736 * Default empty array. 1733 * @since 5.6.0 Changed the function signature so that the `$args` array can be provided as the first parameter. 1734 * 1735 * @param array|string $args Optional. Array of arguments that get passed to get_terms(). 1736 * Default empty array. 1737 * @param array|string $deprecated Taxonomy name. 1737 1738 * @return array|int|WP_Error Number of terms in that taxonomy or WP_Error if the taxonomy does not exist. 1738 1739 */ 1739 function wp_count_terms( $taxonomy, $args = array() ) { 1740 $defaults = array( 1741 'taxonomy' => $taxonomy, 1742 'hide_empty' => false, 1743 ); 1744 $args = wp_parse_args( $args, $defaults ); 1740 function wp_count_terms( $args = array(), $deprecated = array() ) { 1741 // Check whether function is used with legacy signature `$taxonomy` and `$args`. 1742 $use_legacy_args = $args && ( is_string( $args ) && taxonomy_exists( $args ) || is_array( $args ) && wp_is_numeric_array( $args ) ); 1743 1744 $defaults = array( 'hide_empty' => false ); 1745 if ( $use_legacy_args ) { 1746 $defaults['taxonomy'] = $args; 1747 $args = $deprecated; 1748 } 1749 1750 $args = wp_parse_args( $args, $defaults ); 1745 1751 1746 1752 // Backward compatibility.
Note: See TracChangeset
for help on using the changeset viewer.