Filter: bricks/query_api/total_pages
Filter: bricks/query_api/total_pages
Section titled “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 page helpful?