Skip to main content

benecaster_blocks_block_render

Filter Free blocks-widgets

Filters the HTML a Benecaster block or Elementor widget renders. Every block from the Blocks & Widgets Library renders by running the Benecaster shortcode it stands for; this filter receives that HTML, the block’s name, its attributes and the exact shortcode string.

Elementor widgets fire it too, under the matching block’s name — benecaster/donor-wall for the benecaster-donor-wall widget — so a callback cannot tell the two apart, and should not need to.

Only while the add-on is active. Each block also saves its shortcode string, and with the add-on removed that string renders without reaching this filter. For a change that must survive removal, use the shortcode’s own output filter. It also runs for the block editor’s preview, as the signed-in editor.

An empty $html is a real answer: the shortcode rendered nothing for this viewer — not signed in, below a minimum, no episode. For benecaster/transcription it can also mean the Transcription Service plugin is missing, so the shortcode was built and not run. Leave it empty rather than wrapping nothing. Access is never decided here; the shortcode has already decided who sees what.

Block names are benecaster/<name> — episode-player, episode-card, subscribe-cta, feed-url, qr-code, latest-episodes, subscriber-count, show-stats, pricing-table, episode-navigation, related-episodes, episode-share, social-links, platform-links, rss-link, listener-support, donor-wall, transcription. Show Stats saves two shortcodes side by side, so its $shortcode holds both.

Parameters

Name Type Default Description
$html string — What the shortcode rendered
$block_name string — The block's name, e.g. benecaster/episode-player
$attributes array — The block's attributes (or the widget's settings mapped onto them)
$shortcode string — The exact shortcode string that was built

Returns: string

Need this built rather than just documented? See our services →