protected function get_counts( $taxonomies ) {
		global $wpdb;

		if ( count( $taxonomies ) <= 0 ) {
			return [];
		}

		$query = $wpdb->prepare(
			"SELECT `taxonomy`, COUNT(*) AS `count`
			FROM $wpdb->term_taxonomy
			WHERE `taxonomy` IN (" . implode( ',', array_fill( 0, count( $taxonomies ), '%s' ) ) . ')
			GROUP BY `taxonomy`',
			$taxonomies
		);
		// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- $query is already prepared above.
		$counts = $wpdb->get_results( $query );

		// Make sure there's a count for every item.
		$counts = array_merge(
			array_fill_keys( $taxonomies, 0 ),
			wp_list_pluck( $counts, 'count', 'taxonomy' )
		);

		return $counts;
	}
protected function get_counts( $taxonomies ) {
		global $wpdb;

		if ( count( $taxonomies ) <= 0 ) {
			return [];
		}

		$query = $wpdb->prepare(
			"SELECT `taxonomy`, COUNT(*) AS `count`
			FROM $wpdb->term_taxonomy
			WHERE `taxonomy` IN (" . implode( ',', array_fill( 0, count( $taxonomies ), '%s' ) ) . ')
			GROUP BY `taxonomy`',
			$taxonomies
		);
		// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- $query is already prepared above.
		$counts = $wpdb->get_results( $query );

		// Make sure there's a count for every item.
		$counts = array_merge(
			array_fill_keys( $taxonomies, 0 ),
			wp_list_pluck( $counts, 'count', 'taxonomy' )
		);

		return $counts;
	}
protected function get_counts ( $ taxonomies ) { global $ wpdb ; if ( count ( $ taxonomies ) <= 0 ) { return [ ] ; } $ query = $ wpdb -> prepare ( "SELECT `taxonomy`, COUNT(*) AS `count`
			FROM $wpdb->term_taxonomy
			WHERE `taxonomy` IN (" . implode ( ',' , array_fill ( 0 , count ( $ taxonomies ) , '%s' ) ) . ')
			GROUP BY `taxonomy`' , $ taxonomies ) ; // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- $query is already prepared above. $ counts = $ wpdb -> get_results ( $ query ) ; // Make sure there's a count for every item. $ counts = array_merge ( array_fill_keys ( $ taxonomies , 0 ) , wp_list_pluck ( $ counts , 'count' , 'taxonomy' ) ) ; return $ counts ; }
Gets the term counts for each supplied taxonomy.

@param array $taxonomies Taxonomies to fetch counts for.
@return array Associative array of term counts keyed by taxonomy.
Gets the term counts for each supplied taxonomy .