Filter: bricks/query_api/total_pages
Filters the total number of pages calculated for an external API query loop. This is useful when the API response structure for pagination doesn’t match Bricks’ standard extraction logic.
Parameters
Section titled “Parameters”$total_pages(int): The calculated total number of pages.$element_id(string): The ID of the query element.$query_api(object): TheBricks\Integrations\Query\Query_APIinstance.
Example usage
Section titled “Example usage”add_filter( 'bricks/query_api/total_pages', function( $total_pages, $element_id, $query_api ) { // Example: Set total pages for a specific API query if ( $element_id === 'my_api_loop' ) { // Assume you stored the total in a custom property or need a fixed value return 10; }
return $total_pages;}, 10, 3 );Was this helpful?
A quick vote and short notes help us improve these docs faster.
Leave a note for us
Thanks for sharing feedback. We're using it to improve these docs.