Prompt_Api::unsubscribe()

If you've made your own unsubscribe form, this method will do the deed.

Example

$email_address = 'test@example.com';
$status = Prompt_Api::unsubscribe( $email_address );
switch( $status ) {
	case Prompt_Api::NEVER_SUBSCRIBED:
		_e( 
			"Is that address correct? It wasn't ever subscribed.", 
			'example-text-domain' 
		);
		break;
	case Prompt_Api::ALREADY_UNSUBSCRIBED:
		_e( "You've already unsubscribed.", 'example-text-domain' );
		break;
	case Prompt_Api::CONFIRMATION_SENT:
		_e( 
			"You're now unsubscribed. Look for a final confirmation email.", 
			'example-text-domain' 
		);
		break;
}

Parameters

$email_address
(string) (Required) The email address to unsubscribe

Return Value

(string) The resulting status, matching one of the following class constants:

  • Prompt_Api::NEVER_SUBSCRIBED
    The email address wasn't found among existing subscribers.
  • Prompt_Api::ALREADY_UNSUBSCRIBED
    The email address was found, but was not subscribed.
  • Prompt_Api::CONFIRMATION_SENT
    The email address was unsubscribed and a final confirmation sent.

Still need help? Contact Us Contact Us