d before calculating. if ( $per_page > 0 && ( count( $objects ) === $per_page || $page > 1 ) ) { $term_count = $this->get_term_count( $taxonomy, $prepared_args ); $response = ( new Pagination() )->add_headers( $response, $request, $term_count, ceil( $term_count / $per_page ) ); } return $response; } /** * Get count of terms for current query. * * @param string $taxonomy Taxonomy to get terms from. * @param array $args Array of args to pass to wp_count_terms. * @return int */ protected function get_term_count( $taxonomy, $args ) { $count_args = $args; unset( $count_args['number'], $count_args['offset'] ); return (int) wp_count_terms( $taxonomy, $count_args ); } } Warning: Class 'Automattic\WooCommerce\StoreApi\Routes\V1\AbstractTermsRoute' not found in /var/www/vhosts/bikcommunicatie.nl/webspace/httpdocs/bikcommunicatie.nl/wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/StoreApi/deprecated.php on line 42 Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/bikcommunicatie.nl/webspace/httpdocs/bikcommunicatie.nl/wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/StoreApi/Routes/V1/AbstractTermsRoute.php:1) in /var/www/vhosts/bikcommunicatie.nl/webspace/httpdocs/bikcommunicatie.nl/wp-includes/pluggable.php on line 1421