wpf_get_tags()

#Overview

This function retrieves all CRM tags currently associated with the user.

#Parameters

wpf_get_tags( $user_id = false, $force = false )
  • $user_id (int) (Optional): The user ID to search.
  • $force (bool) (Optional): Whether to force-refresh the tags.

#Return

(array) $user_tags The users tags in the CRM.

#Get the current user’s tags

$tags = wpf_get_tags();

#Get the tags for a different user

$tags = wpf_get_tags( $user_id );

#Force an update of the user’s tags by sending an API call to your CRM

In this case the updated tag list will automatically be saved to the local user meta after it’s been retrieved.

$tags = wpf_get_tags( $user_id, true );

#Display the current user’s tags in a list

$tags = wpf_get_tags();

echo '<ul>';
foreach ( $tags as $tag ) {
	echo '<li>' . wpf_get_tag_label( $tag ) . '</li>';
}
echo '</ul>';

#Get all available tags

If you want to get all available tags in your CRM, with their names and IDs, you can do so using wpf_get_option()

$available_tags = wpf_get_option( 'available_tags' );

Was this helpful?