Skip to main content

benecaster_guest_manager_get_episode_guests()

Episode Premium guest-manager
benecaster_guest_manager_get_episode_guests( int $episode_id ): array

An episode’s guests, for the Email Editor, AI Search, Transcription or your own code. It is the one supported way to read them: never query the benecaster_episode_guests table. See Read an episode’s guests from another add-on.

Parameters

Name Type Default Required Description
episode_id int — Yes A benecaster_episode post id.

Return Value

Type: array

The guests linked to the episode, in the episode's order, each [ 'id' => int, 'name' => string, 'title' => string, 'organization' => string, 'website' => string, 'profile_url' => string ]: the guest's post id, name, title (job or description, '' when not set), organization ('' when not set), own website (http/https, or '') and the address of their public guest page. [] when the id is not an episode, when the episode has no guests, or when Guest Manager is not on for the episode's own show. Only published guests are returned.

Example

$guests = function_exists( 'benecaster_guest_manager_get_episode_guests' )
    ? benecaster_guest_manager_get_episode_guests( $episode_id )
    : [];

foreach ( $guests as $guest ) {
    echo esc_html( $guest['name'] );
}

Hooks Fired

Notes

profile_url is the guest's public page, /guests/{slug}/, or /?benecaster_guest_page={slug} under plain permalinks, {slug} being the guest's slug, which is kept when the guest is renamed. See Restyle, extend or override a guest's public page.

To show title and organization as one line, join them as Guest Manager does: Founder, Acme Labs, or whichever is set. The guest's private email is never included.

To read one guest by id rather than an episode's guests, use benecaster_guest_manager_get_guest().

There is no access or status check on the episode: it answers for drafts too. If you show guests to a visitor, decide whether that visitor may see the episode. Values are raw text, so escape them on output.

It is defined on every request while Guest Manager is active, even when it is off on every show (it then returns []). Guard calls with function_exists(), since Guest Manager may not be installed. Keys may be added in later versions; none will be removed or change meaning.

Need this built rather than just documented? See our services →