Skip to main content

Steady Switch: show and hide content for members

Legacy feature: show and hide content depending on membership. Not access control – use the Steady API for ads, scripts and protected content.

Steady Switch is a legacy feature. We stopped recommending it in November 2022 and cannot provide technical support for it. It keeps working everywhere the Steady code is embedded, and there is no shutdown date. For new integrations – especially anything involving ads, third-party scripts or protected access – use the Steady API instead.

Steady Switch shows one block of HTML to your members and a different one to everyone else.

Typical use cases:

  • hide ads for members

  • show a membership prompt to non-members

  • show a thank-you message or bonus link to members

  • swap small static HTML blocks depending on membership

Steady Switch is not access control. It shows and hides content in the browser – both versions are still delivered to the browser and visible in the page source. Do not use it for paid articles, private downloads, secret links, discount codes or personal data. For genuinely protected content use the Steady paywall, posts hosted on Steady, or a server-side check via the Steady API.

Before you start

The Switch only works if the Steady widget can tell whether someone is a member. All of this has to be true:

  • The Steady code is installed on your website – not only on the page with the Switch, but at least on the homepage too.

  • The Steady code appears exactly once per page.

  • Your website has a Steady login, a paywall or another Steady integration that lets visitors log in.

  • The visitor is logged in to Steady in that browser.

  • Your HTML is valid and is not being altered by a CMS, cache or optimisation plugin.

Show content to members only

<script type="text/plain" data-steady-switch data-when="subscription"><!--
CONTENT FOR MEMBERS
--></script>

Show content to non-members only

<script type="text/plain" data-steady-switch data-when="no-subscription"><!--
CONTENT FOR NON-MEMBERS
--></script>

Your content belongs between <!-- and -->, and that comment sits inside the script tags. There has to be a line break directly after <!-- and directly before --> – without both of them the Switch does not work.

About the syntax: the code changed in June 2022. The old type="steady-switch" notation is still recognised, but we recommend the version shown above for new installations.

Example: hide ads for members

Put your ad code into the block for non-members. Members will not see the ads.

<script type="text/plain" data-steady-switch data-when="no-subscription"><!--
<div class="ad-container">
YOUR AD CODE HERE
</div>
--></script>

If your ad code contains HTML comments of its own – for example <!-- /leaderboard --> – remove them first. HTML comments cannot be nested: the inner --> closes the Switch block early, and everything after it becomes visible to everyone, members included. This is the most common reason ads still show up for members.

Common mistakes

Content sits outside the comment

The content has to be between <!-- and -->. If it sits after the closing script tag it is never switched and always shown.

The line breaks are missing

There has to be a line break after <!-- and before -->. Without them the Switch does not work. The tricky part: HTML minifiers strip these silently, so your code still looks correct in the editor. The WordPress plugin Autoptimize (its "Optimize HTML" option) has broken the Switch this way more than once.

Nested HTML comments

Your content must not contain HTML comments itself. Remove them before you paste the code in.

Wrong data-when values

Only subscription for members and no-subscription for non-members are valid. Variants such as member, non-member, no_subscription or subscribed are not recognised. Also check you have not swapped the two – that is the usual reason the wrong thing gets hidden.

The Steady code is included more than once

The Steady code belongs on each page exactly once. A common cause of a duplicate: the Steady WordPress plugin and an extra header snippet running at the same time. Pick one.

What does not work reliably

The Switch only inserts the matching HTML block after the Steady widget has loaded. If that block contains JavaScript or depends on another script, the order stops being predictable. Simple static elements work well: text, links, images, layout containers.

  • WordPress shortcodes are not processed inside the Switch, they show up as plain text. Use an HTML or embed element instead.

  • Asynchronously loaded ads often are not hidden correctly, particularly Google AdSense Auto Ads. Switching to the synchronous ad snippet has fixed many of these cases.

  • Not every ad network fits. In our experience Taboola and Seeding Alliance work. Google AdSense causes by far the most problems. We have not tested Ezoic.

How to test it properly

You cannot check the member view with your own account: as the owner of the project you always have member access, so you always see the subscription content. Test the non-member view in a private window, and the member view with a second account that holds a real membership of your publication.

Check all three states:

  • Logged out: the no-subscription content shows, the subscription content does not.

  • Logged in, but not a member: same result.

  • Logged in as an active member: the subscription content shows, the no-subscription content does not.

Also test on desktop and mobile, after clearing all caches, with optimisation plugins switched on, and on the live domain rather than only in preview.

Troubleshooting

Nothing shows up

Check in order: is the Steady code installed, including on the homepage? Does it appear only once per page? Is there a login or paywall so visitors can be recognised? Did a CMS or optimisation plugin remove the script block or the HTML comment? Are the line breaks still there? Is a cache serving an old version? Are the data-when values spelled exactly right?

Both versions show up

Usually the content is not inside the comment, or a nested comment ended the block early. Look at the page source and check that your content really sits between <!-- and -->.

The wrong version shows up

Check whether the person is actually logged in and holds an active membership for this publication – and whether you swapped subscription and no-subscription. Remember your own account always counts as a member.

It works in preview but not live

Typical causes are page cache, Cloudflare, a WordPress optimisation plugin, script minification, a consent manager delaying scripts, or an ad blocker. Clear all caches and switch optimisation plugins off for a test.

Static HTML works, ads do not

Remove nested HTML comments from the ad code, switch from asynchronous to synchronous ad code, and check that your ad network is compatible. If none of that helps, there is no way around a server-side solution.

When the Switch is not enough

If your setup depends on ads, third-party scripts or real access protection, the Switch is the wrong tool. Use the Steady API and check membership status on the server instead.

Did this answer your question?