benecaster_guest_manager_guest_page_data
Filters what a guest’s public page (/guests/{slug}/) draws, before the guest/profile.php and guest/episodes.php templates run. The array holds guest_id, name, title, organization (drawn on its own line after the title), bio (HTML, paragraphs added), photo_url (the medium size, or ''), website, social (a list of { platform, url }), publications (a list of { title, url, rel, affiliate, type, year, details }, as the guest/publications.php template receives it) and episodes: a list of { episode_id, show_id }, the guest’s published episodes on shows where Guest Manager is on, newest first by publish date. The affiliate line under the publications is worked out after this filter, from the publications it leaves, and so is shows, the episodes grouped by show for guest/episodes.php ([{ show_id, name, episodes }], in order of the guest’s latest appearance on each show), so filtering episodes is enough to move or drop a show.
Values are raw; the templates escape them. Keys a callback leaves out keep their values.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$page |
array |
— | `guest_id`, `name`, `title`, `organization`, `bio`, `photo_url`, `website`, `social`, `publications`, `episodes` |
$guest_id |
int |
— | The guest whose page is shown |
Returns:
array
Example
// Leave trailers off guest pages.
add_filter( 'benecaster_guest_manager_guest_page_data', function ( array $page ): array {
$page['episodes'] = array_values( array_filter(
$page['episodes'],
fn( array $e ): bool => 'trailer' !== get_post_meta( $e['episode_id'], '_benecaster_episode_type', true )
) );
return $page;
} );
Notes
A return that is not an array is ignored. An episode added to episodes is drawn with the visitor's access applied, so a locked episode shows locked. Walkthrough: Restyle, extend or override a guest's public page.
Affects
- Guest page
Need this built rather than just documented? See our services →