wp_sms_add_subscriber
Action hook triggered when a new user subscribes to SMS notifications.
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.
Parameters
| Parameter | Type | Description |
|---|---|---|
$name | string | The subscriber’s name |
$mobile | string | The subscriber’s mobile number |
Usage
add_action('wp_sms_add_subscriber', 'your_callback_function', 10, 2);
Example
Send a welcome SMS to a user when they subscribe:
function send_sms_when_subscribe_new_user($name, $mobile) {
$to = array($mobile);
$msg = "Hi {$name}, Thanks for subscribing.";
wp_sms_send($to, $msg);
}
add_action('wp_sms_add_subscriber', 'send_sms_when_subscribe_new_user', 10, 2);
Use Cases
- Send a welcome SMS to new subscribers
- Log subscription events to a database
- Integrate with CRM systems
- Trigger email notifications to admins
- Add subscribers to external mailing lists
Related
- wp_sms_send() - Function to send SMS messages
Last updated: December 23, 2024