Skip to main content

Embed a show QR code on a marketing page

Free Beginner Since v1.0.0

Use the anonymous public endpoint GET /wp-json/benecaster/v1/shows/{id}/qr.png to embed a show’s public signup QR code on any marketing page, press kit, or static site. The endpoint returns raw PNG bytes — no auth required, cached 24 hours. Anyone who scans the QR reaches the show’s public signup page; no subscriber data is exposed.

Code

<?php
// On single-show installs use the auto-resolver; on multi-show installs
// pass the show ID explicitly (e.g. from a page custom field or the URL).
$show_id = benecaster_get_sole_show_id(); // returns null when 0 or > 1 show exists

if ( ! $show_id ) {
    return; // No show resolved — bail silently.
}

$qr_url    = rest_url( 'benecaster/v1/shows/' . (int) $show_id . '/qr.png' );
$show_name = get_the_title( $show_id );

printf(
    '<img src="%s" alt="%s" width="240" height="240" />',
    esc_url( $qr_url ),
    esc_attr( sprintf( 'Subscribe to %s', $show_name ) )
);

View on GitHub →