1. Home
  2. Docs
  3. Subscribe2
  4. Hooks, API & Customization
  5. s2_unsublink_public s2_unsublink_registered

s2_unsublink_public s2_unsublink_registered

These hooks allow site specific styling and text wrapping to be applied to the URI links generated by the {UNSUBLINK} keyword.

function custom_public_unsublink( $link, $email_type ) {
    if ( 'text' === $email_type ) {
        return "To unsubscribe click here:\r\n" . $link;
    } else {
        return 'To unsubscribe click here:
<a href="' . $link . '">' . $link . '</a>';
    }
}
add_filter( 's2_unsublink_public', 'custom_public_unsublink', 10, 2 );
 
function custom_registered_unsublink( $link, $email_type ) {
    if ( 'text' === $email_type ) {
        return "You may manage your subscription options from your profile\r\n" . $link;
    } else {
        return sprintf( 'You may manage your subscription options from your <a href="%s">profile</a>', $link );
    }
}
add_filter( 's2_unsublink_registered', 'custom_registered_unsublink', 10, 2 );
Was this article helpful to you? Yes No

How can we help?