Send SMS Messages with wp_sms_send() in WordPress

Updated on Jan 03, 2023

In this document, we will show you how to use the wp_sms_send() function to send SMS messages through the WP SMS plugin for WordPress. This function is a powerful tool that allows you to send SMS messages to any phone number or group of numbers, with customizable text and options. We will provide you with step-by-step instructions on how to use the wp_sms_send() function and demonstrate some examples of its use. Let’s get started!

Parameters

wp_sms_send( $to, $msg, $is_flash = false, $from = null, $mediaUrls = [] );
  • $to (array) (Required) The receiver number or numbers.
  • $msg (string) (Required) The SMS text message.
  • $is_flash (boolean) (Optional) Only if you want to send flash SMS.
  • $from (int) (Optional) Sender ID.
  • $mediaUrls (array) (Optional) Media URLs for sending via MMS.

Examples

  • Send SMS to multi numbers.
$to = array('+1111111111', '+1111111112');
$msg = "Your Message";
wp_sms_send( $to, $msg);
  • Send Flash SMS
$to = array('+1111111111', '+1111111112');
$msg = "Your Message";
wp_sms_send( $to, $msg, true);
  • Send MMS
$to = array('+1111111111', '+1111111112');
$msg = "Your Message";
$urls = ['https://imageurl.com'];
wp_sms_send( $to, $msg, false, null, $urls);