Skip to main content

Add and Remove Tags with JavaScript

Usage

ActiveMember360 provides functions that let you add and remove tags for the contact associated with the current remote user.

The functions are mbr_add_tags and mbr_remove_tags.

Both accept as a parameter a comma separated list of tag IDs.

The adding or removing of any contact tags are immediately effective within WordPress for the the current remote user.

Functions

mbr_add_tags ( $tags )

mbr_remove_tags ( $tags )

Parameters

ParametersTypeDescription
$tags(string)One or more tag ID's defined within ActiveCampaign specified in a comma separated string and to be added to/removed from the contact associated with the remote user. The available tags can be found in ActiveMember360, Utilities, Tags.
Default: none.
Required: yes.

Examples

Using this Javascript code snippet in conjunction with a HTML button with the CSS class mbr-add-tags when the button is clicked the tags with IDs 66 and 67 will be added to the remote user.

<script>
jQuery( document ).ready( function( $ ) {
$( '.mbr-add-tags' ).click( function() {
mbr_add_tags( '66,67');
} );
} );
</script>
<button class="mbr-add-tags">Add Tags 66 and 67</button>