wp_sms_get_option()
Retrieve plugin options programmatically using the wp_sms_get_option() function.
The wp_sms_get_option() function allows you to retrieve any available options from the WSMS or WSMS Pro plugin. This function returns settings and option values for your SMS configuration.
Syntax
wp_sms_get_option( $option_name, $pro = false, $setting_name = '' );
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
$option_name | string | Yes | — | The option name to retrieve |
$pro | boolean | No | false | Set to true to get options from WSMS Pro settings |
$setting_name | string | No | '' | Custom setting name to retrieve option from |
Return Value
Returns the option value if found, or false if the option does not exist.
Examples
Get WSMS Option
Retrieve an option from the default WSMS settings:
// Get international_mobile option value from WSMS settings
$value = wp_sms_get_option('international_mobile');
Get WSMS Pro Option
Retrieve an option from WSMS Pro settings:
// Get wc_mobile_field option value from WSMS Pro settings
$value = wp_sms_get_option('wc_mobile_field', true);
Get Option from Custom Setting
Retrieve an option from a custom setting group:
// Get option_name value from custom setting
// The $pro parameter can be either true or false when using custom setting_name
$value = wp_sms_get_option('option_name', false, 'wps_wc_otp');
Related
- wp_sms_send() - Function to send SMS messages
Last updated: December 23, 2024