Customize SMS Subscription with wp_sms_add_subscriber

Updated on Jan 03, 2023

This action allows you to perform custom actions when a new user subscribes to SMS notifications in WordPress. Use this action to trigger events or integrate with other services when a user opts in to receive SMS updates.

Example:

Send an SMS to a user when registering a new subscriber.

function send_sms_when_subscribe_new_user($name, $mobile) {
    $to = array($mobile);
    $msg = "Hi {$name}, Thanks for subscribe.";
    wp_sms_send( $to, $msg )
}
add_action('wp_sms_add_subscriber', 'send_sms_when_subscribe_new_user', 10, 2);