This action is triggered whenever a user’s tags are modified.


  • $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 user
  • wpf_tags_removed: Triggered whenever tags are removed from a user


#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 );

#Debug a tag change

This example writes a backtrace to the WP Fusion logs to figure out where a tag change came from.

It can be especially helpful when using a CRM on the same site like FluentCRM or Groundhogg, as you can see what page or automation triggered the tag change.

function debug_tags_modified( $user_id, $user_tags ) {

	if ( user_can( $user_id, 'manage_options' ) ) {
		wpf_log( 'notice', $user_id, '<pre>' . print_r( debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 50 ), true ) . '</pre>' );


add_action( 'wpf_tags_modified', 'debug_tags_modified', 10, 2 );

This example limits the logging to administrators (users with the manage_options capability), but it could also be adjusted to look for specific user IDs, contact IDs, or tag IDs.

Was this helpful?