Unsubscribe by URL
Allow subscribers to opt-out from SMS newsletter via URL.
Allow subscribers to unsubscribe from your SMS newsletter by clicking a URL link.
URL Format
The standard unsubscribe URL structure:
https://yourdomain.com/?wpsms_unsubscribe=MOBILE_NUMBER
Example
https://yourdomain.com/?wpsms_unsubscribe=01111111111
When a subscriber visits this URL, they will be automatically unsubscribed.
URL Shortening
If Bitly integration is enabled, long unsubscribe URLs can be shortened:
https://bit.ly/3x2esyx
See Bitly URL Shortener for setup instructions.
Add to Welcome SMS
Automatically include the unsubscribe link in welcome messages:
add_filter('wpsms_welcome_sms_message', function ($message, $mobile) {
$unsubscribeUrl = WPSms()->newsletter()->generateUnSubscribeUrlByNumber($mobile);
$message .= "\r\nUnsubscribe: " . $unsubscribeUrl;
return $message;
}, 10, 2);
NOTE
For line breaks, use %0A or \r\n depending on your SMS gateway.
Customize Query String
Change the default wpsms_unsubscribe parameter to a custom name:
add_filter('wpsms_unsubscribe_query_string', function ($queryString) {
return 'unsubscribe';
});
This changes the URL to:
https://yourdomain.com/?unsubscribe=MOBILE_NUMBER
Troubleshooting
Access Denied Error
If subscribers see “Access Denied” when using the unsubscribe URL, CSRF protection may be blocking the request.
See Disable CSRF for Unsubscribe to resolve this issue.
Related
- Manage Subscribers - View and manage subscribers
- Newsletter Settings - Configure newsletter
- Bitly URL Shortener - Shorten URLs
- wpsms_unsubscribe_csrf_enabled - CSRF filter
Last updated: December 28, 2025