Skip to main content

benecaster_subscriber_count_output

Filter Premium

Filters the final rendered output of benecaster_subscriber_count before it is returned to the page. $count is the raw integer (pre-format, pre-label) — useful for conditional logic. Returns empty string when count is below the minimum threshold — $count is still the actual count.

Return the complete HTML string for the shortcode. Cast with (string).

This value becomes the shortcode’s return value and is not escaped by Benecaster — WordPress emits it as the shortcode’s output. Escape every dynamic part yourself; this is the filter to be careful with, not the display-side ones that run through esc_html().

Returning '' makes the shortcode render nothing at all, which is the supported way to suppress it conditionally. The $atts parameter is the shortcode’s resolved attributes, so a callback can scope itself to one usage rather than every instance on the site.

Parameters

Name Type Default Description
$output string Rendered shortcode HTML output
$count int Raw integer subscriber count (pre-format, pre-label)
$atts array Resolved shortcode attributes including type, format, minimum, label

Returns: string

Example

add_filter( 'benecaster_subscriber_count_output', function( $output, $count, $atts ) {
    // Append a "and counting!" suffix when the count exceeds 1000.
    if ( $count > 1000 && $output ) {
        $output .= ' and counting!';
    }
    return $output;
}, 10, 3 );