benecaster_episode_move_blockers
Filters the reasons an episode can’t be moved to another show yet. Benecaster checks them before anything is written. If the list comes back non-empty, the move is refused with 409 episode_move_blocked, the response’s data.blockers carries the list, and the episode editor shows each label to the podcaster as written. Translate your labels.
Benecaster never lets a move take away something a listener paid for, so the list already holds its own blockers when your callback runs:
required_buyup: the episode requires one of the old show’s buy-ups.buyup_access: buy-up access is set on the episode.standalone_access: the episode carries access under a name that is none of the old show’s tiers,publicor the follower slug, which is how a standalone sale reaches an episode.
Add a blocker for access your plugin grants that Benecaster can’t see, such as a purchase you supply without writing an availability date for it. You can add blockers but not remove Benecaster’s. Its own blockers stay whatever the filter returns, and an entry without a non-empty type and label is ignored.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$blockers |
array |
— | List of blockers, each `[ 'type' => string, 'label' => string ]`. `type` is a short slug of your choosing; `label` is shown to the podcaster. |
$episode_id |
int |
— | ID of the episode being moved |
$from_show_id |
int |
— | ID of the show it would leave |
$to_show_id |
int |
— | ID of the show it would move to |
Returns:
array
Examples
Refuse a move while your store sells the episode
add_filter( 'benecaster_episode_move_blockers', function ( array $blockers, int $episode_id ): array {
if ( my_store_sells_episode( $episode_id ) ) {
$blockers[] = [
'type' => 'my_store_sale',
'label' => __( 'This episode is for sale in My Store. Remove it from the sale first.', 'my-store' ),
];
}
return $blockers;
}, 10, 2 );
Notes
A move that passes every blocker fires benecaster_episode_move_before and then benecaster_episode_move_after.
Need this built rather than just documented? See our services →