highreel
Developers

Each member's Highreel in WordPress

One snippet adds a [highreel] shortcode. It finds the signed-in member's link with Highreel's API, keeps it with their account, and shows their banner.

3 min read

This is for members who sign in to WordPress itself: WooCommerce customer accounts, and membership plugins that use WordPress's own accounts. It needs someone who can add a few lines of PHP to the site. Every WordPress function in it is from WordPress's developer reference, read on 13 November 2026.

How it works

The first time a member opens a page with [highreel], your server asks Highreel's API for their link by their WordPress email, in this year's Highreel. The link goes into their user meta as highreel_link, so later pages read it from your own database and never wait on Highreel. Members who aren't in the Highreel see nothing, and are asked about again only twice a day.

The snippet shows a member the Highreel that goes with the email on their WordPress account, so it's only as sure as that email. If people can make an account on your site, or change their email, without confirming the address is theirs, someone could type another member's address and be shown that member's Highreel. Use the API key where addresses are confirmed; where they aren't, fill in each member's link yourself (Without an API key, below).

Set it up

  1. Make an API key.

    In Highreel, Integrations › My developer › Make an API key. Copy it once.

  2. Keep it in wp-config.php.

    Add define( 'HIGHREEL_API_KEY', 'hr_live_…' ); above the line that says to stop editing, so the key stays out of your theme and your database.

  3. Find the Highreel's id.

    Integrations lists your Highreels under Is it working?, each with Copy id in its menu, and its Email your developer puts every id in the email. Or list them with the API.

  4. Add the snippet.

    Paste it into your child theme's functions.php, or a code snippets plugin, and replace YOUR_HIGHREEL_ID.

  5. Place the shortcode.

    Edit the page members land on, add a Shortcode block, and type [highreel]. [highreel variant="bar"] gives the slim bar instead of the card.

functions.php
<?php
// Highreel: [highreel] shows the signed-in member their own Highreel.
// In wp-config.php: define( 'HIGHREEL_API_KEY', 'hr_live_…' );
const HIGHREEL_ID = 'YOUR_HIGHREEL_ID';

function highreel_link_for( WP_User $user ) {
	// Kept from an earlier visit (or put there by an import).
	$link = get_user_meta( $user->ID, 'highreel_link', true );
	if ( $link || ! defined( 'HIGHREEL_API_KEY' ) || get_transient( 'highreel_none_' . $user->ID ) || get_transient( 'highreel_wait' ) ) {
		return $link;
	}
	$url = add_query_arg(
		array(
			'email'    => rawurlencode( $user->user_email ),
			'highreel' => HIGHREEL_ID,
		),
		'https://highreel.app/api/v1/people'
	);
	$response = wp_remote_get( $url, array(
		'timeout' => 5,
		'headers' => array( 'Authorization' => 'Bearer ' . HIGHREEL_API_KEY ),
	) );
	if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
		// No answer, or the key was refused: nobody's page asks again for a minute.
		set_transient( 'highreel_wait', 1, MINUTE_IN_SECONDS );
		return '';
	}
	$body = json_decode( wp_remote_retrieve_body( $response ), true );
	$link = $body['data'][0]['link'] ?? '';
	if ( $link ) {
		update_user_meta( $user->ID, 'highreel_link', $link );
	} else {
		// Not in this Highreel: ask again in half a day, not on every page.
		set_transient( 'highreel_none_' . $user->ID, 1, 12 * HOUR_IN_SECONDS );
	}
	return $link;
}

add_shortcode( 'highreel', function ( $atts ) {
	$atts = shortcode_atts( array( 'variant' => 'card' ), $atts, 'highreel' );
	if ( ! is_user_logged_in() ) {
		return '';
	}
	$link = highreel_link_for( wp_get_current_user() );
	if ( ! $link ) {
		return '';
	}
	wp_enqueue_script( 'highreel-embed', 'https://highreel.app/embed/v1.js', array(), null, array(
		'strategy'  => 'async',
		'in_footer' => true,
	) );
	return '<highreel-banner link="' . esc_url( $link ) . '" variant="' . esc_attr( $atts['variant'] ) . '"></highreel-banner>';
} );

The shortcode returns its HTML rather than printing it, as WordPress asks, escapes the link with esc_url, and loads Highreel's script only on pages that show a banner, at the end of the page and without holding it up.

Without an API key

The snippet reads highreel_link from each member's user meta first, so you can fill that in yourself instead: from the links file, with any import tool that writes user meta, or one member at a time with WP-CLI.

Terminal
wp user meta update ana@example.com highreel_link https://highreel.app/r/Ab12Cd34Ef56

Leave HIGHREEL_API_KEY out of wp-config.php and the snippet never calls the API.

Next year

Change HIGHREEL_ID to the new Highreel and clear the old links, so members get this year's: with WP-CLI, wp user meta delete for each member, or a one-line delete_metadata( 'user', 0, 'highreel_link', '', true ) run once.

Questions

Does it work with my membership plugin?

If your members sign in with WordPress accounts, yes: the snippet asks WordPress who is signed in and reads their email, which every plugin built on WordPress accounts keeps.

What if Highreel is slow or down?

The request gives up after 5 seconds and the page shows no banner that time. The snippet then waits a minute before asking again for anyone, so a slow moment holds up one page, not every page. Members whose link is already kept never wait on Highreel at all.

Does it work with a caching plugin?

The banner is different for each member, so the page it's on mustn't come from a cache that signed-in members share. If your caching plugin keeps copies of pages for signed-in members, leave this page out of it, or one member could be shown another's banner.

Why not a Custom HTML block?

A Custom HTML block shows the same thing to everyone. Each member needs their own link in the tag, which takes a few lines of PHP that know who is signed in: that's the shortcode.

Keep reading

Your customers had a great year. Show them.

No account needed · from $99 per campaign