has_tag()

Overview

This function determines whether a user has a given tag. A tag ID or label can be provided.

if( wpf_has_tag( 'Paying Customer' ) ) {

	echo "Thanks for your payment!";

}

Or more complex conditions can be created by combining calls to has_tag(), for example:

if( wpf_has_tag( 'New Customer' ) && ! wpf_has_tag( 'Watched Intro Video' )  ) {

	echo "Welcome to our site! Please watch our introduction video here:";

}

To check the tags for a specific user, pass a $user_id as the second parameter:

if( wpf_has_tag( 'Paying Customer', $user_id ) ) {

	echo "Thanks for your payment!";

}

Was this helpful?