benecaster_tier_price_output
Filters the text output of benecaster_tier_price before it is returned to the page. The incoming value is empty if the tier is not found or has no price, and 0 for a plan marked free.
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.
The incoming value has already had redundant trailing zeros stripped (15.00 arrives as 15, 9.99 unchanged) and carries no currency symbol — per project convention the symbol is kept outside translatable strings and added by the template. A callback re-formatting the number should not assume two decimal places are present.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$output |
string |
— | Raw price number as text (e.g. '15'); empty string if not found |
$show_id |
int |
— | ID of the show the tier was looked up on. The tier slug is `$atts['tier']`. |
$atts |
array |
— | Resolved shortcode attributes |
Returns:
string
Example
add_filter( 'benecaster_tier_price_output', function( $output, $show_id, $atts ) {
// Format the raw price with a currency symbol.
if ( '' !== $output ) {
$output = '$' . number_format( (float) $output, 2 ) . '/mo';
}
return $output;
}, 10, 3 );
Need this built rather than just documented? See our services →