Skip to main content

benecaster_ep_page_query_var

Filter Free Since v1.0.0

Overrides the URL query variable used by [benecaster_episodes paged="true"] to read the current page number. The default query var is ep_page — all paged episode shortcodes on the same page share this var, which means changing page via Previous/Next affects every paged shortcode simultaneously.

Use this filter to assign a unique query var per shortcode instance (e.g. ep_page_42 for show 42) so multiple paged lists on the same page paginate independently. The filter receives $show_id and $atts for per-shortcode disambiguation.

Parameters

Name Type Default Description
$query_var string The query variable name. Default `'ep_page'`.
$show_id int The show ID resolved for this shortcode render.
$atts array The resolved shortcode attribute array after defaults are applied.

Returns: string

Examples

Disambiguate by show ID so two paged lists paginate independently

add_filter( 'benecaster_ep_page_query_var', function ( string $query_var, int $show_id, array $atts ): string {
    return 'ep_page_' . $show_id;
}, 10, 3 );

Notes

When you change the query var, the Previous / Next links generated by the shortcode automatically use the overridden var name. The benecaster_episodes_pagination_output filter receives the same $query object — if you build custom pagination HTML inside that filter and need the current page, call get_query_var( 'ep_page_' . $show_id ) (or whatever var name your callback returns here) rather than hardcoding ep_page.