benecaster_archive_pagination_html
Filters the pagination HTML rendered in archive/pagination.php. Return null to suppress pagination entirely.
Return an HTML string, or null. Output through wp_kses_post(), so post-level tags survive and <script> does not.
Any falsy return — null or '' — suppresses the entire <nav> wrapper, not merely its contents, because the template guards with if ( $pagination_html ). That is the supported way to remove pagination.
The incoming value is already null when there is only one page, so a callback that unconditionally returns markup will render pagination on single-page archives too. $show_id is 0 on the global archive.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$html |
string|null |
— | Pagination HTML; null to suppress pagination |
$total_pages |
int |
— | Total number of pages in the archive |
$show_id |
int |
— | ID of the show |
Returns:
string|null
Example
add_filter( 'benecaster_archive_pagination_html', function( $html, $total_pages, $show_id ) {
// Suppress pagination when there is only one page.
if ( $total_pages <= 1 ) {
return null;
}
return $html;
}, 10, 3 );
Affects
- archive/pagination.php template part