OTHER DOCS Available


Conditional shortcode to control access to portions of a post, page or widget based on the logged in user’s tags.

Shortcode Examples

To display a message if someone has a tag

[memb_has_any_tag tag_id=123]Message[/memb_has_any_tag]

To display a message if someone has a tag

[memb_has_any_tag tag_id=123 output="message"]

Check a radio button in a form if the user has a tag:

<input type="radio" name="foo" value="123" [memb_has_any_tag tag_id=101 output="checked"] >

Check a checkbox in a form if the user has a tag:

<input type="checkbox" name="foo" value="123" [memb_has_any_tag tag_id="103" output="checked"] >

Select a dropdown option if the user has a tag:

<option value="foo" [memb_has_any_tag tag_id="103" output="selected"] >Foo</option>

Display “Yes” or “No” if the user has the tag:

[memb_has_any_tag tag_id="105"]

Display output only if the user has the tag:

[memb_has_any_tag tag_id="107" output="You have the tag!"]
[memb_has_any_tag tag_id="107"] You have the tag! [/memb_has_any_tag]

Display output only if the user does not have the tag:

[memb_has_any_tag tag_id="109" not="not" output="You do not have the tag!"]

Shown to users with these tags [else_memb_has_any_tag] Shown if user doesn’t have specified tags [/memb_has_any_tag]

[memb_has_any_tag tag_id="101,102"]
   Shown to users with these tags
   Shown if user doesn’t have specified tags

When written out to completion the shortcode looks like this,

[memb_has_any_tag tag_id="1290"]
   This is only visible to those who have tag ID 1290.  This tag is named "Demo Master"
   Shown to anyone else, who is lacking those tags.

is the same as

[memb_has_any_tag tag_id="Demo Master"]
   This is only visible to those who have the tag named "Demo Master".
   Shown to anyone else, who is lacking those tags.

If you’d like to restrict access to allow more than one group to see content, while restricting others who don’t have those tags, you can do so by separating each tag name or ID with a comma.

[memb_has_any_tag tag_id="TagA,TagB,123,456"]
   Shown to users with these tags
   Shown if user doesn’t have specified tags


[memb_has_any_tag tag_id="101,102"]
   Shown to users with these tags
   Shown if user doesn’t have specified tags

To display the list of purchased items from ActiveCampaign, you can use the shortcode in the following format:

[memb_has_any_tag tag_id="ProductTag1"]Product Name1[/memb_has_any_tag] 
[memb_has_any_tag tag_id="ProductTag2"]Product Name2[/memb_has_any_tag] 
[memb_has_any_tag tag_id="ProductTag3"]Product Name3[/memb_has_any_tag]

Shortcode Parameters​

capture:  Capture the output of the shortcode and route it to a variable for later use. (Read More…)

except_contact_id:  A comma separated list of ActiveCampaign Contact ID’s that the current user must not be one of in order for the test to succeed.

except_tag_id:  A comma separated list of tag names or tag ID’s that the current user must not have.

min:  The number of minimum matching tags the contact must have to also pass the test.

not:  You can use the attribute not=”not”, to reverse the results of the test.

output:  Message to be displayed if the test is successful.

tag_id: A comma separated list of tag names or IDs.

txtfmt: A comma separated list of text processing functions to be used to post process the contact fields. (Read More…)

One of the core functions of Memberium is to control access to the pages on your WordPress website based on the identity of the logged in member. This is useful when you want to prevent access to content, or to dynamically control what content is displayed to visitors based on the tags they have.

Sometimes you may want (or need) a finer detailed way to control access to parts of your page, or to display different content in areas of your pages to your members based on their tags.

Why Tags?

ActiveCampaign uses tags to segment your audience to make your marketing more effective. Similarly, you can use those same tags to control how Memberium behaves when your members login to the site.

Tag Names vs. Tag ID’s

The shortcode can use either the Tag ID, or the Tag Name.  You can find the tag names and IDs in ActiveCampaign, by going to ActiveCampaign Tag Manager.  Multiple Tag Names and ID’s can be used in a single shortcode by separating them with a comma.  Do not include extra spaces after or before the comma.

Tag Names

The advantage of using Tag Names is that it makes the code VERY easy to read, which is useful when setting up and troubleshooting your shortcodes.  No more guessing what Tag #781 is.  Tag Names do require the tag to be unique int the system.  Additionally the are more resilient to deletion since if you delete the tag, and recreate it and the shortcode will automatically work with the new tag.

Tag ID’s

The advantage of using Tag ID’s is that they’re unchanging and faster to process and more specific if you have multiple tags with the same name in different categories.  Generally we recommend to NOT re-use the same tag name, but if you do you can specify the tag more accurately by using the Tag ID#.

A Note on Testing for Membership Levels

It is not recommended to use [memb_has_any_tag] to test for access to Membership Levels.  Membership levels consist of 2-4 tags and a user’s access is determined by the mix of tags they have, not just the presence of the membership tag itself.  If you need to test for membership levels, you should use the [memb_has_membership] shortcode instead, which is designed with the membership level concept in mind.  Additionally there is the [memb_has_payf] shortcode for testing for the various PAYF tags.

Testing for ALL Tags

If you need to test to see if a user has ALL the tags in a set, you should use [memb_has_all_tags].  This specially designed shortcode is much more efficient than building a complex test using [memb_has_any_tag].

Usage Inside HTML Tags

As of WordPress 4.3, you cannot use open and closing shortcodes inside of HTML tags.  We provide a parameter called “output”, to enable you to conditionally display output if the tag test succeeds.  This is especially useful in HTML forms where you may want to add the attribute “selected” or “checked” to pre-select a form option.

Conditional Tags

[memb_has_any_tag] is a conditional shortcode. Conditional shortcodes perform a test and then display (or don’t display) the content within the shortcode depending on the result of the test. Conditional shortcodes are often nestable so that you can perform multiple tests. All tests are binary meaning they resolve to a simple true-false / sucess-fail / yes-no condition.


If you have a series of tests, one after another, you may need to nest your shortcodes.


Administrator accounts are always treated as successfully passing all tests. It is not possible to get a failure result as an Administrator. It is recommended that you create regular subscriber users to test the behavior of the site.

Shortcode Attributes

Conditional: Yes (Read More…)
Nestable: Yes (Read More…)
Accepts formatting: Yes (Read More…)
Capturable: Yes (Read More…)

Additional Information

The [else_memb_has_any_tag] shortcode is entirely optional.  If you skip the [else_memb_has_tag] clause, then the contents of the shortcode will only be displayed on success, and nothing will be displayed on failure.

For more complex conditions, you can nest conditional shortcodes within each other.

In order to keep things clear, as you nest your shortcodes, put a digit at the end of the shortcode name, so that the shortcode processor can tell which shortcode pieces go together.

For example:


If the shortcodes end before the next one starts, you are not nesting them and do not need to number them:


If you are nesting different shortcodes, you do not need to number them:



9 ways to add more value to your membership site


This Applies To