groundhogg/contact/is_marketable

πŸ“… Published on

πŸ“ Last updated

Documentation

Β»

Filter Hooks

Β»

groundhogg/contact/is_marketable

Filters whether a contact is considered marketable. Called inside Contact::is_marketable() before any email is sent. Return false to suppress sends to a contact regardless of their opt-in status.

apply_filters( 'groundhogg/contact/is_marketable', $is_marketable, $contact );

You will receive the default boolean result as the first argument and the Contact object as the second.

Example

add_filter( 'groundhogg/contact/is_marketable', 'my_extension_check_suppression', 10, 2 );

/**
 * Suppress sends to contacts on an external suppression list.
 *
 * @param bool                 $is_marketable
 * @param \Groundhogg\Contact $contact
 *
 * @return bool
 */
function my_extension_check_suppression( $is_marketable, $contact ) {
    if ( ! $is_marketable ) {
        return false;
    }

    return ! my_extension_is_suppressed( $contact->get_email() );
}

Was this helpful?

Let us know if this document answered your question. That’s the only way we can improve.