Skip to main content

Suppress or override the feed redirect tag without changing stored settings

Free Beginner Since v1.0.0

The itunes:new-feed-url redirect tag is driven by stored post meta, but sometimes you need to suppress it for a specific tier feed without touching the settings — for example, when testing migration, or when only public tier feeds should carry the redirect. This recipe clears the new_feed_url key at compile time without modifying stored meta.

Code

<?php
// Suppress the redirect tag for the free tier only.
add_filter( 'benecaster_feed_channel_data', function ( array $data, int $show_id ): array {
    // $tier_slug is available via the feed request context stored in the token.
    // For a tier-agnostic override, just clear the key unconditionally.
    $data['new_feed_url'] = '';
    return $data;
}, 10, 2 );

View on GitHub →

Hooks Used