Fires after a contact record has been saved from the admin edit screen. All standard fields and meta have already been updated.
do_action( 'groundhogg/admin/contact/save', $contact_id, $contact );
You will receive the contact ID as an integer and the Contact object.
Example
add_action( 'groundhogg/admin/contact/save', 'my_extension_save_custom_field', 10, 2 );
/**
* Save a custom admin field when a contact is saved.
*
* @param int $contact_id
* @param \Groundhogg\Contact $contact
*
* @return void
*/
function my_extension_save_custom_field( $contact_id, $contact ) {
if ( isset( $_POST['my_extension_account_tier'] ) ) {
$contact->update_meta(
'account_tier',
sanitize_text_field( $_POST['my_extension_account_tier'] )
);
}
}
Was this helpful?
Let us know if this document answered your question. Thatβs the only way we can improve.
