Company Blog Support
Martin Cogburn


    Back to Top

    Use Shortcodes to Show/Hide Content on a WordPress Page


    About Shortcodes

    The PilotPress plugin comes with the ability to hide or reveal content using shortcodes. These nifty little show-if tags can be placed around blocks of text, forms, etc in the body of your WordPress pages to allow you to personalize the content of the page based on membership level, tags or even if the contact is currently being tracked by ONTRAPORT. The Shortcodes currently available for use in PilotPress are shown in the sections below.


    Note: If you're not comfortable using shortcodes, we highly recommend simply protecting pages, posts or categories instead. See this article for detailed information.


    Show Content Based on Membership Level

    [show_if has_one="Many,levels"] content [/show_if] Displays content only for members who are logged in and have ANY of the membership levels listed (separated by commas)
    [show_if has_all="Many,levels"] content [/show_if] Displays content only for members who are logged in and have ALL of the membership levels listed
    [show_if not_one="Many,levels"] content [/show_if] Displays content for members who are logged in and are missing ALL the memberships listed.
    [show_if not_any="Many,levels"] content [/show_if] Displays content for members who are logged in and are missing any of the memberships listed.


    Showing content to members with any of these membership levels: Gold, Silver or Bronze:

    [show_if has_one="Gold,Silver,Bronze"] Content for any of these members here [/show_if]

    A person with the Gold membership level will see the content, even if they do not have Silver and/or Bronze. They must have at least one of the levels, and can have all three. 

    Showing content only to members that have both the Gold and Silver membership levels:

    [show_if has_all="Gold,Silver'] Content only for those with both Gold and Silver memberships [/show_if]

    A person must have both the Gold and Silver membership levels to see the content. They can also have other membership levels, but must have all of the ones listed.

    Showing content to people without a particular membership level:

    [show_if not_one="Gold"] Content telling the member to upgrade to the Gold membership[/show_if]

    This is often used to encourage a member to upgrade their membership to another level, without bothering those members who have already upgraded.


    Show Content Based on a Single Tag

      [show_if has_tag="Tag"] content [/show_if] Displays content only for members who are logged in and have the tag indicated by "Tag" 

    You can have this shortcode reveal the content within a few seconds of adding the Tag in ONTRAPORT, even if the Member remains logged in, provided: 

    1. You have checked the Disable API Caching check box in Settings > PilotPress > Advanced Settings

      Advanced settings in PilotPress

    2. The page must be refreshed, or the Member must navigate to the page with shortcode on it after the Tag is added to the Contact Record in ONTRAPORT.

    Note that this function checks only for a single tag. You cannot use multiple tags in the shortcode.

    You can use this function to reveal content without adding a membership level. A Rule on an opt in or order form could add the Tag to the Contact Record and the content would be available almost immediately. Note that some functions may take longer to update the Contact Record in ONTRAPORT; a global Rule that triggers when a Tracked Link is clicked or a URL is visited can take 7 to 10 minutes to register in the Contact Record. Rules on forms generally add a Tag within a few seconds.

    Show Content if Contact is Identified

    For Logged in Members Only

    [show_if is_contact] content [/show_if] Displays content if logged in member is also a Contact in ONTRAPORT.
    [show_if not_contact] content [/show_if] Shows content if the logged in member is NOT a Contact in ONTRAPORT.

    For Any Cookied Contact (logged in or not)

    ONTRAPORT contacts are cookied if they have previously logged into your membership site or take any ONTRAPORT defined action (email click, form fill out, tracked link click, etc.)

    [show_if is_cookied_contact] content [/show_if] Displays the content if PilotPress can read an ONTRAPORT cookie.
    [show_if not_cookied_contact] content [/show_if] The content is displayed if PilotPress does not find a cookie.

    Shortcode and Merge Field Conflicts

    We now have aliases for show-if shortcodes, Login Pages, and Merge Fields. These are used when other WordPress plugins have merge field conflicts with Pilotpress. In order to use the alias, simply add "pilotpress_" in from of the field name, but after the first bracket ( [ ).

    Examples of alias format

    The aliases are formatted as follows:

    • If you have [show_if has_tag="thistag"] use the alias [pilotpress_show_if has_tag="thistag"]

    • If you have [login_page] use the alias [pilotpress_login_page]

    Old merge fields will continue to work, however now they will insert as: "[pilotpress_field name='First Name']""

    Additional Features

    • You can nest Merge Fields inside of a Shortcode. 
      Example: [show_if has_tag="thistag"][pilotpress_field name='First Name'][/show_if]

    Testing Membership Levels and Shortcodes

    Wordpress Administrators are "cookied" by WordPress. WordPress will read the Administrator's cookie even while logging in as another user. Private and incognito modes in your browser will not prevent WordPress from reading the Administrator cookie. Because of this, shortcodes and membership level protection may appear to fail. To test shortcodes and other membership functions we recommend the following process:

    • Create a new Contact for testing purposes. Add a Membership level to the contact. Keep ONTRAPORT open to this contact record.

    • Open a new private tab or window in your browser (see instructions for Firefox and Chrome).

    • In the private tab or window, clear the cookies for your Wordpress site. This step is required. To see instructions on how to clear your cookies, click HERE.

    • Go to the default WordPress login page by adding "/wp-login.php" to your domain:

    • Log in as your new contact. Test the functionality of your membership levels and shortcodes.

    • To test a new membership level, log the contact out of Wordpress. Add the new membership level in ONTRAPORT and log the contact back into Wordpress.

    Important Notes

    • You must use a private browsing window and clear your site's cookies in order to log in with a Contact's login credentials.

    • You cannot nest the show-if tags due to a limitation of WordPress.

    • Other plugins may interfere with PilotPress, including (but not limited to):

      1. Any other "membership" plugin

      2. Any plugin that manages "redirection"

      3. Caching plugins

      4. All in One SEO

      5. Yoast WordPress SEO

      6. Backup Buddy

      7. Page Expiration Robot or Scarity Samuri

      8. User Role Editor

      9. Login Form Editors (using redirection)

    Check with Support if you believe you have a conflict with another plugin.






    WordPress Integration Resources






    Articles in this section

    Created - Updated
    Have more questions? Submit a request


    • Avatar
      Joseph Hollak

      Can I have the first paragraph of a blog post visible to the public (non-members) and require membership to read the rest of the blog post?

      Or, is it an all-or-nothing behavior?

    • Avatar
      Jeff Maughan

      Hey Joseph,


      You would just need to wrap the part you want to be hidden in the appropriate tags.  For example, in your blog post you could put something like this:

      Content you want to be accessible to all visitors.

      [show_if not_one="your-subscription-level(s)"] <a href="your subscribe link">Subscribe here</a> to read the rest of this article, or <a href="your login page">log in</a>. [/show\if]_

      [show_if has_one="your-subscription-level(s)"] Content that should only be accessible to members. [/show\if]_

    • Avatar
      Core Love

      The tags used to update just from refreshing the page.  This does not seem to work anymore.  I have tested it with two different servers, with no plugins active except pilot press and the standard 2013 & 2014 wp themes.  I update the tags in the ontraport customer contact area.  This used to work for me and no longer does.  

    • Avatar
      Jeff Maughan

      Hey Core Love,


      My show/hide tags are still working... can you provide more info about the tags you are using?

    • Avatar
      Core Love

      My tags are working to show/hide content.  The issue is when adding a tag to a member, the tag does not appear for the member until they log out and then log back into wordpress again.  

    • Avatar
      Nomiki Georgiadis

      Can we please have a video tutorial on how to set this up.

    • Avatar
      Devin Slavin

      Is there a way to HIDE content from logged in members?

      What I'd love to do is hide an "upgrade" button from anyone who has already upgraded/logged in.

    • Avatar
      Jeff Maughan


      Wrap the upgrade button in [show_if not_one="YOUR UPGRADED MEMBERSHIP LEVEL"][/show_if]. Should do the trick.

    Powered by Zendesk