Skip to main content

benecaster_redirect_expiry_run

Action Free Since v1.0.0

Fires once per daily cron run after Benecaster has processed expired `itunes:new-feed-url` redirect tags. After the hook fires, all affected shows have had their redirect meta removed and their feed caches invalidated. Use `$show_ids` to trigger per-show notifications or external integrations for each affected show.

This hook fires even on days when no redirect tags expired — `$count` will be `0` in that case. Always guard with a count check to avoid unnecessary work.

Parameters

Name Type Default Description
$expired_count int Number of redirect tags removed in this run

Examples

Email show owners when redirect tag is removed

add_action( 'benecaster_redirect_expiry_run', function ( int $count, array $show_ids ): void {
    if ( $count === 0 ) {
        return;
    }

    foreach ( $show_ids as $show_id ) {
        $owner_email = get_post_meta( $show_id, '_benecaster_show_author_email', true );
        $show_title  = get_the_title( $show_id );

        if ( $owner_email ) {
            wp_mail(
                $owner_email,
                sprintf( 'Feed redirect removed: %s', $show_title ),
                sprintf(
                    'The iTunes new-feed-url redirect for "%s" has expired and been removed from your feed.',
                    $show_title
                )
            );
        }
    }
}, 10, 2 );

Notes

Applies to timed redirect durations only (6 months or 1 year). Shows configured with a Permanent redirect never expire and will never appear in $show_ids. Feed caches for affected shows are already invalidated before this hook fires — you do not need to clear them in your callback.