benecaster_guest_manager_guest
Filters one guest as other add-ons read them through benecaster_guest_manager_get_guest(), and each guest benecaster_guest_manager_get_guests() lists: [ 'id' => int, 'name' => string, 'title' => string, 'organization' => string, 'website' => string, 'photo_url' => string, 'profile_url' => string, 'bio' => string, 'edit_url' => string ]. bio is the guest’s bio as plain text; edit_url is the guest’s record on the Guests screen in Benecaster’s admin, returned whoever is viewing, so show it only to users with manage_options. Runs only for a guest the function would return.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$guest |
array |
— | `id`, `name`, `title`, `organization`, `website`, `photo_url`, `profile_url`, `bio`, `edit_url`; values are raw text |
$guest_id |
int |
— | The guest |
Returns:
array|null
Example
// Hide guests marked private in your own meta from every add-on that reads them.
add_filter( 'benecaster_guest_manager_guest', function ( array $guest, int $guest_id ): ?array {
return get_post_meta( $guest_id, '_my_private_guest', true ) ? null : $guest;
}, 10, 2 );
Notes
Return null to hide the guest from callers; any other return that is not an array is ignored. A guest hidden from get_guests() is left out of its page without changing total. Walkthroughs: Read one guest by id from another add-on and Walk the whole guest roster from another add-on.
Need this built rather than just documented? See our services →