Skip to main content

benecaster_email_verification_url

Filter Free

Filters the single-use link mailed to a subscriber who has asked to change their email address. The default is GET /benecaster/v1/account/verify-email?token={user_id}:{secret}. Use this filter to route the click through your own landing page before handing off to the endpoint, or to swap the REST URL for a prettier one.

⚠ Whatever URL you return must still reach AccountController::verify_email() carrying the same token value. The plaintext secret exists only inside this URL — it is stored as a SHA-256 hash — so a link that drops or rewrites the token cannot be recovered, and the pending change simply expires (24 hours) with the subscriber never able to complete it.

This filter fires when the change is requested, not when it is verified. For the completed change, hook the benecaster_email_changed action.

Parameters

Name Type Default Description
$verify_url string The default verification URL
$user_id int WordPress user ID of the subscriber requesting the change
$new_email string The address the subscriber is asking to change to (unverified)

Returns: string

Examples

Route through a custom landing page

add_filter( 'benecaster_email_verification_url', function ( string $url, int $user_id, string $new_email ): string {
    return add_query_arg( 'token', wp_parse_url( $url, PHP_URL_QUERY ), home_url( '/confirm-email/' ) );
}, 10, 3 );

Notes

Fires once per change request, not per verification. The plaintext secret in the token query arg is never stored — only its SHA-256 hash is, in _benecaster_pending_email_token usermeta — so preserve the token exactly.

Affects

  • Subscriber Account Page

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