Skip to content

Instantly share code, notes, and snippets.

@tobeyadr
Last active January 30, 2022 03:48
Show Gist options
  • Save tobeyadr/1a9b69bea8bc33355c13068532558755 to your computer and use it in GitHub Desktop.
Save tobeyadr/1a9b69bea8bc33355c13068532558755 to your computer and use it in GitHub Desktop.
<?php
// get the contact record if one exists
$contact = \Groundhogg\get_contactdata( 'email@example.com' );
// Get a list of contact ids
$tags = $contact->get_tags();
// to get a list of ID >> Name
$tag_id_to_name = [];
// Populate the list
foreach ( $tags as $tag_id ) {
// create a tag object based on the ID
$tag = new \Groundhogg\Tag( $tag_id );
$tag_id_to_name[ $tag_id ] = $tag->get_name();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment