Available Helper Functions #
The plugin provides 6 public PHP functions for working with GHL tags in your custom code:
Reading Tags #
// Get tag IDs for a user
$tag_ids = ghl_crm_get_user_tag_ids( $user_id );
// Get tag names for a user
$tag_names = ghl_crm_get_user_tag_names( $user_id );
// Check if a user has a specific tag
$has_tag = ghl_crm_user_has_tag( $user_id, 'tag-name' );
// Get the GHL Contact ID for a user
$contact_id = ghl_crm_get_user_contact_id( $user_id );
Modifying Tags #
// Add tags to a user's GHL contact
ghl_crm_add_tags_to_user( $user_id, ['tag1', 'tag2'] );
// Remove tags from a user's GHL contact
ghl_crm_remove_tags_from_user( $user_id, ['tag1'] );
Tag Caching #
GHL tags are cached per-location using site transients. The cache refreshes automatically but can be cleared manually from the plugin settings.
