benecaster_guest_manager_get_guests()
benecaster_guest_manager_get_guests( array $args = [] ): array
Every guest on the site, a page at a time, for an add-on that needs the whole roster rather than one guest or one episode’s, such as AI Search backfilling its index. It is the one supported way to list guests: never query the benecaster_guest posts yourself. See Walk the whole guest roster from another add-on.
Parameters
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
args |
array |
[] |
No | page (from 1; default 1) and per_page (1 to 100; default 50; a larger number is cut to 100). |
Return Value
Type:
array
[ 'guests' => list, 'total' => int ]. guests is one page of published guests, A–Z by name, each with exactly the keys benecaster_guest_manager_get_guest() returns, and any key added there later. total is the number of published guests; a page past the last is empty, with the same total. [ 'guests' => [], 'total' => 0 ] while Guest Manager is off on every show.
Example
$result = function_exists( 'benecaster_guest_manager_get_guests' )
? benecaster_guest_manager_get_guests( [ 'page' => 1, 'per_page' => 100 ] )
: [ 'guests' => [], 'total' => 0 ];
foreach ( $result['guests'] as $guest ) {
echo esc_html( $guest['name'] );
}
Hooks Fired
Notes
Not gated by show. Guests are the site's, so a guest linked to no episode, or only to episodes on a
show where Guest Manager is off, is listed. When you draw a guest on an episode, check that episode's
show yourself with benecaster_addon_is_active()
( 'benecaster-addon-guest-manager', $show_id ).
Page by total. Each entry passes
benecaster_guest_manager_guest. A guest that filter hides is
left out of its page without changing total, so a page may hold fewer than per_page: keep paging
until you have asked for total guests' worth of pages, not until a page is short or empty.
To keep an index current, hook benecaster_guest_manager_after_save_guest and benecaster_guest_manager_after_delete_guest rather than walking the roster again.
Values are raw text, so escape them on output. The guest's email is never included. It is defined on
every request while Guest Manager is active. Guard calls with function_exists(), since Guest Manager may
not be installed.
Need this built rather than just documented? See our services →