groundhogg/contact/tags_removed

πŸ“… Published on

πŸ“ Last updated

Documentation

Β»

Action Hooks

Β»

groundhogg/contact/tags_removed

Fires once after a batch of tags has been removed from a contact. The complement to groundhogg/contact/tags_applied.

do_action( 'groundhogg/contact/tags_removed', $contact, $tag_ids );

You will receive the Contact object as the first argument and an array of removed tag IDs as the second.

Example

add_action( 'groundhogg/contact/tags_removed', 'my_extension_on_tags_removed', 10, 2 );

/**
 * Revoke membership access when the member tag is removed.
 *
 * @param \Groundhogg\Contact $contact
 * @param int[]                $tag_ids
 *
 * @return void
 */
function my_extension_on_tags_removed( $contact, $tag_ids ) {
    if ( in_array( MY_EXTENSION_MEMBER_TAG_ID, $tag_ids ) ) {
        my_extension_revoke_access( $contact->get_user_id() );
    }
}

Was this helpful?

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