Skip to main content

benecaster_email_changed

Action Free

Fires after a subscriber’s requested email address change has been verified and written to wp_users.user_email, from AccountController::verify_email().

Fires on the verified change only. Requesting a change — saving a new address on the benecaster_account PROFILE section — fires nothing, because the address is unproven at that point. A callback that syncs it to a mailing list or CRM must hook this action, not the request; syncing on request would sync whatever the subscriber mistyped, before they have even proven they can receive mail at it.

Parameters

Name Type Default Description
$user_id int — WordPress user ID of the subscriber
$old_email string — The address the account had until now
$new_email string — The verified address now on the account

Example

add_action( 'benecaster_email_changed', function ( int $user_id, string $old_email, string $new_email ): void {
    my_crm_update_contact_email( $user_id, $old_email, $new_email );
}, 10, 3 );

Notes

To customize the link mailed to the subscriber before it is clicked, see the benecaster_email_verification_url filter, which fires at request time rather than at verification.

Affects

  • Subscriber Account Page

Need this built rather than just documented? See our services →