benecaster_guest_manager_rest_guest
Filters each guest the Guests screen’s REST routes return (benecaster-guest-manager/v1/guests): a roster row, { id, name, title, organization, photo_url, episode_count, latest_appearance }, or the editor’s profile, { id, name, title, organization, bio, photo_id, photo_url, website, social, email, profile_url }.
Admin-only data, but whatever you add is sent to the browser. The guest’s private email is in the profile only, never in a roster row.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$data |
array |
— | The guest as the route is about to return it |
$guest |
array |
— | The stored guest it was built from: `{ id, name, bio, photo_id, title, organization, website, social, email }` |
$context |
string |
— | `summary` for a roster row, `profile` for the editor's view |
Returns:
array
Example
// Add the guest's booking status to the editor's view.
add_filter( 'benecaster_guest_manager_rest_guest', function ( array $data, array $guest, string $context ): array {
if ( 'profile' === $context ) {
$data['booking_status'] = (string) get_post_meta( $guest['id'], 'my_booking_status', true );
}
return $data;
}, 10, 3 );
Notes
A return that is not an array is ignored. Walkthrough: Read, create, change or delete guests from code, as the Guests screen does.
Affects
- Benecaster → Guests
Need this built rather than just documented? See our services →