Skip to main content

benecaster_feed_url_output

Filter Free

Filters the full rendered HTML output of the [benecaster_feed_url] shortcode, after the masked or revealed display state of the subscriber’s feed URL is determined. Returns an empty string when the current user is not a subscriber — the filter fires in that case too, making it possible to inject a subscribe prompt or call to action for non-subscribers.

Parameters

Name Type Default Description
$html string Full rendered shortcode output; empty string if the current user is not a subscriber
$show_id int ID of the show
$atts array Resolved shortcode attributes

Returns: string

Examples

Inject subscribe link for non-subscribers

add_filter( 'benecaster_feed_url_output', function( $html, $show_id, $atts ) {
    // Show a subscribe prompt for non-subscribers (empty output).
    if ( '' === $html ) {
        $subscribe_url = get_post_meta( $show_id, '_benecaster_subscribe_url', true );
        return '<p>Subscribe to access your personal RSS feed. <a href="' . esc_url( $subscribe_url ) . '">Subscribe →</a></p>';
    }
    return $html;
}, 10, 3 );

Show simple fallback message when not subscribed

add_filter( 'benecaster_feed_url_output', function ( string $html, int $show_id, array $atts ): string {
    if ( '' === $html ) {
        return '<p>Subscribe to get your private feed URL.</p>';
    }
    return $html;
}, 10, 3 );

Affects

  • [benecaster_feed_url](/shortcodes/benecaster-feed-url/) shortcode