groundhogg/contact/tag_applied

πŸ“… Published on

πŸ“ Last updated

Documentation

Β»

Action Hooks

Β»

groundhogg/contact/tag_applied

Fires each time a single tag is applied to a contact. When multiple tags are applied at once this hook fires once per tag. For a single hook that fires after the full batch, use groundhogg/contact/tags_applied.

do_action( 'groundhogg/contact/tag_applied', $contact, $tag_id );

You will receive the Contact object as the first argument and the integer tag ID as the second.

Example

add_action( 'groundhogg/contact/tag_applied', 'my_extension_on_tag_applied', 10, 2 );

/**
 * Grant VIP access when the VIP tag is applied.
 *
 * @param \Groundhogg\Contact $contact
 * @param int                  $tag_id
 *
 * @return void
 */
function my_extension_on_tag_applied( $contact, $tag_id ) {
    if ( $tag_id !== MY_EXTENSION_VIP_TAG_ID ) {
        return;
    }

    my_extension_grant_vip_access( $contact->get_email() );
}

Was this helpful?

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