#Overview
This action is triggered whenever a user’s tags are modified.
#Parameters
$user_id
: The user ID$user_tags
: An array of all of the user’s current tags
#See also
wpf_tags_applied
: Triggered whenever tags are added to a userwpf_tags_removed
: Triggered whenever tags are removed from a user
#Examples
#Remove a tag when another tag is applied
WP Fusion includes a lot of interfaces for applying tags, but because removing tags is less common most of our integrations don’t include options for removing tags.
This example removes the tag Pending Signup when the tag Profile Complete is applied.
function remove_pending_signup_tag( $user_id, $tags_applied ) {
$tag_to_check = wpf_get_tag_id( 'Profile Complete' );
$tag_to_remove = wpf_get_tag_id( 'Pending Signup' );
if ( in_array( $tag_to_check, $tags_applied ) ) {
wp_fusion()->user->remove_tags( array( $tag_to_remove ), $user_id );
}
}
add_action( 'wpf_tags_applied', 'remove_pending_signup_tag', 10, 2 );
Was this helpful?
Let us know if you liked the post. That’s the only way we can improve.