Skip to main content

benecaster_guest_manager_after_save_guest

Action Premium guest-manager

Fires after a guest was created or changed on Benecaster → Guests (or through the Guests REST routes, or by approving their Guest portal changes), only once the write succeeded.

Parameters

Name Type Default Description
$guest_id int — The guest's post id
$fields array — Only the keys sent, cleaned: `name`, `title`, `organization`, `bio`, `website`, `social` (a list of `{ platform, url }`), `publications` (the whole list, each `{ title, url, year, type, affiliate, outlinks_id }`), `photo_id`, `email` (the guest's private email, trimmed and lowercased; `''` removes it)
$created bool — `true` for a new guest, `false` for a change

Example

// Mirror every guest edit into a CRM.
add_action( 'benecaster_guest_manager_after_save_guest', function ( int $guest_id, array $fields, bool $created ): void {
    my_crm_upsert_contact( 'guest-' . $guest_id, $fields );
}, 10, 3 );

Notes

A guest created by Import Existing Guests fires it too, with $created true (Run or watch the guest import from code). Writes made another way (WP-CLI, wp_update_post()) do not fire it. 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 →