Skip to main content

[benecaster_access_gate]

Shows its content to whoever holds one of your buy-ups or a one-off purchase, and the content after [benecaster_else] to everyone else. The sibling of benecaster_tier_gate, and the way to deliver an buy-up that isn’t an episode — a colouring book, a PDF, a bonus video, a members-only page.

[benecaster_access_gate buyup="colouring-book"]
  <a href="/wp-content/uploads/colouring-book.pdf">Download the colouring book</a>
[benecaster_else]
  [benecaster_subscribe]
[/benecaster_access_gate]

It hides the link. It does not protect the file. The gate shows or hides the content you wrote between the tags and does nothing to the file a link points at. A file in your media library keeps its ordinary web address, and anyone who is given that address can open it. Decide what you deliver this way with that in mind. There is no file attribute.

Three forms:

  • buyup="slug" — holds that buy-up. The slug is the buy-up’s Access token type.
  • grant="slug" — bought that one-off purchase (an Episode Sales product, or a slug an
    add-on registers).
  • No selector — holds anything extra on this show: any buy-up or any purchase.

buyup and grant are separate attributes on purpose and cannot be combined. A buy-up and a purchase can share a slug, and they end differently: a buy-up lasts only as long as the membership it rides on, while a purchase is owned outright and survives the end of the membership. Writing both on one gate takes the else branch and raises _doing_it_wrong(); use two gates for an either/or.

Whole episodes are not gated here. Tick the buy-up on the episode’s Access tab for that. This shortcode shows and hides parts of a page. Anything beyond showing or hiding — adding a holder to a mailing list, a Discord role, calling another system — is benecaster_user_has_buyup() or benecaster_user_holds_grant() in code.

In the editor. Type / in an episode’s page content or a credit template and choose Buy-up Gate. It inserts a block with two halves to type into — Shown to people who have it and Shown to everyone else — and a settings panel where you pick A buy-up, A one-off purchase or Anything extra, then choose from your own list rather than typing a slug. The panel repeats that the gate hides the link and does not protect the file. A gate typed by hand opens as a block too, with both halves intact, the next time the content is opened in the editor; the saved content is the same shortcode either way.

Only the taken branch is ever run, exactly as for [benecaster_tier_gate]: the content is split on the first [benecaster_else] before any shortcode inside it runs. No [benecaster_else] means a visitor without the grant sees nothing. Gates cannot be nested — an inner closing tag closes the outer gate. Sequential gates are fine.

Fails closed. Logged-out visitors, an unknown slug, a buy-up the visitor doesn’t hold, an id belonging to another show, and both selectors at once all take the else branch.

No license check — website gating isn’t license-gated. Documented as min_plan: premium because buy-ups need a paid plan and built-in membership.

In the RSS feed the gate resolves per compiled feed. A gate in an episode’s page content or a show’s content puts the gated branch in that buy-up’s (or purchase’s) own feed and the else branch in every other feed — the public feed, follower feeds and every tier feed. Differences from the website, all failing closed:

  • Only the gate is resolved in the feed. Every other shortcode still arrives as text.
  • benecaster_access_gate_passes and benecaster_access_gate_output do not fire in the
    feed — a feed request has no logged-in visitor to pass them.
  • A gate whose show_id names a different show takes the else branch.
  • The no-selector form opens for a listener who holds any buy-up or purchase the show sells.

In the feed the gate resolves against everything the listener holds, not against which of their feeds an episode came from, so a holder sees the gated branch on every episode that carries the gate, public episodes and tier episodes included. Everyone else, and the public feed, gets the else branch.

Filters: benecaster_access_gate_passes ( bool $passes, int $show_id, array $selector, int $user_id ) — fires before either branch renders, website only. benecaster_access_gate_output ( string $output, bool $passes, int $show_id, array $atts ) — website only.

Recipe

Deliver a downloadable extra to the people who bought your buy-up

Premium Beginner

A buy-up gates episodes with no code at all — tick it on the episode’s Access tab. For everything else you might sell as a buy-up — a colouring book, a PDF, a bonus video, a members-only page — use benecaster_access_gate.

In an episode. Open the episode, click into Full Page Content, type / and choose Buy-up Gate. It inserts a block with two halves — Shown to people who have it and Shown to everyone else. In its settings, pick A buy-up and choose it from your list, then put the download link in the first half and whatever everyone else should see in the second. No shortcode to type.

On any other page or post, put the material between the shortcode’s tags:

[benecaster_access_gate buyup="colouring-book"]
  <a href="https://example.com/wp-content/uploads/2026/colouring-book.pdf">Download your colouring book (PDF)</a>
[benecaster_else]
  <p>The colouring book comes with the Colouring Book extra.</p>
  [benecaster_subscribe]
[/benecaster_access_gate]

buyup is the buy-up’s Access token type. grant="season-one" asks the other question — a one-off purchase, owned outright — and a bare [benecaster_access_gate] means anyone who has bought anything extra on the show. These are the same three choices the block’s settings offer as A buy-up, A one-off purchase and Anything extra.

It hides the link. It does not protect the file. A media-library URL between the tags keeps its ordinary web address, and anyone who is given it can open the file.

Drop to PHP when the answer has to do something rather than show something — below, putting buyers on a mailing list when they visit a page. Use benecaster_user_has_buyup() for a buy-up, which lasts only as long as the membership it rides on, and benecaster_user_holds_grant() for a one-off purchase, which is owned outright and survives the end of the membership. Keep the two separate: a buy-up and a purchase can share a slug and mean different things.

Whole episodes still belong on the Access tab — don’t wrap an episode’s audio or its whole body in a gate. In an episode’s page content the gate resolves in the RSS feed too: a holder’s podcast app shows the gated half on every episode that carries it, and the public feed and everyone else get the else half.

<?php
// Put colouring-book buyers on a mailing list when they open the "crafts" page.
add_action( 'template_redirect', function (): void {
    if ( ! is_page( 'crafts' ) || ! is_user_logged_in() ) {
        return;
    }

    $user_id = get_current_user_id();
    $show_id = 3;  // The show that sells the buy-up.

    // The "Colouring Book" buy-up's row ID in benecaster_buyups.
    // A buy-up lasts only as long as the membership it rides on.
    $colouring_book_buyup_id = 12;

    if ( benecaster_user_has_buyup( $user_id, $colouring_book_buyup_id, $show_id ) ) {
        my_crm_subscribe( $user_id, 'crafts' ); // Your mailing-list integration.
    }

    // A one-off purchase is owned outright and survives the end of the membership.
    if ( benecaster_user_holds_grant( $show_id, 'season-one', $user_id ) ) {
        my_crm_subscribe( $user_id, 'season-one-buyers' );
    }
} );

View on GitHub →

Parameters

Name Type Default Required Description
buyup string — No A buy-up's Access token type on this show. The visitor passes when they hold that buy-up. Cannot be combined with grant.
grant string — No A one-off purchase's grant slug. The visitor passes when they own it. Cannot be combined with buyup or id.
id int 0 No A buy-up's numeric ID, only for two buy-ups that share an Access token type. Prefer buyup: an ID does not survive an export/import or a move from staging to production. Takes precedence over buyup when both are given.
show_id int current show No Show the slug is resolved against. Defaults to the current show/episode's show, then to the sole show on a single-show install.

Example

<!-- A download for holders of one buy-up, the sign-up form for everyone else -->
[benecaster_access_gate buyup="colouring-book"]
  <a href="/wp-content/uploads/colouring-book.pdf">Download the colouring book</a>
[benecaster_else]
  [benecaster_subscribe]
[/benecaster_access_gate]

<!-- A one-off purchase -->
[benecaster_access_gate grant="season-one"]
  Thanks for buying Season One — here are the liner notes.
[/benecaster_access_gate]

<!-- Anyone who has bought anything extra -->
[benecaster_access_gate]
  Thank you for supporting the show beyond your membership.
[/benecaster_access_gate]