Start typing to search...

How to protect part of a page/post

/

User Guides

How to protect part of a page/post

If you’re looking to protect only part of a page or post on your WordPress site, you can do so with Passster’s Area Protection.

A browser window showing a website with the Passster protection form: purple Protected Area headline, instruction text, password field, and purple Unlock button
What visitors see on a protected page: the Passster password prompt in place of the content.

The first thing you’ll need to do is create the area you want to protect.

Create your protected area

To do this, take the following steps:

  1. From your WordPress dashboard, go to Passster > Protected Areas.
  1. Click the Add New button at the top of the page. This will open up a page that looks a lot like a normal page editor in WordPress.
The Protected Areas screen listing areas with their source, Copy Shortcode buttons, protection type, and password columns
The Protected Areas overview: each area with its shortcode, protection type, and password.
  1. Give this ‘area’ a title.
    1. This title is only used on the backend of your site (it will not be visible on the front end of your site). So give it a name that will help you organize/structure it better.
  2. Then add your ‘area’ content.
    1. You can add anything you would normally add to a page or post in this section.
The protected area editor with the area title, Protection Mode set to Password, a password field with Generate password link, and the area shortcode with a Copy Shortcode button
Creating a protected area: name it, set the protection, and copy its shortcode.
  1. Once happy, click the Publish button at the top of the page.

Note: You can also use your Page Builder theme here. To do this, you’ll need to activate Protected Areas in your page builder before you can use it to style your areas. 

Here are a couple of tutorials on how to do that:

Once you’re happy with your content, we’ll need to generate and customize the shortcode.

Customize your shortcode

Once you’ve saved or published your page, you’ll see a button called Copy Shortcode underneath the Redirect settings on the right-hand side. Click it and the shortcode for your protected area will be copied.

The Shortcode card showing the passster area shortcode in a code chip next to a Copy Shortcode button
Every protected area gets a shortcode you can paste into any page, post, or widget.

A shortcode is a small amount of text and numbers within square brackets like this: [passster password="password" area="81"]

This shortcode can then be added to any WordPress page or post to display your protected content hidden behind a form.

Now that your basic shortcode has been created, there are a few settings you can change that will alter what kind of protection you’d like. This will also change the contents of the shortcode itself.

To do this, take the following steps:

  1. While still on the edit page for your protected area, open up the settings sidebar if not already open. You can do this by opening the protected area’s Settings panel.
The Passster panel with Activate Protection on, Protection Mode set to Password, a masked password with Generate password link, User Restriction enabled with User Role, and a Redirect URL field
The full per-post protection panel: mode, password, user restriction, and redirect.
  1. Here you’ll be able to pick the type of protection you’d like from the Protection Type dropdown. Including:
    1. Password
    2. Multiple Passwords
    3. Password lists
    4. Google reCAPTCHA
  1. Based on your selection, the fields below will change, and the description text underneath it will guide you on filling out the fields.
  2. Next, scroll to the User Restriction section. Here you’ll be able to decide if you want to unlock the content for certain users or user roles automatically.
The User Restriction toggle enabled with Restriction Type set to User Role and the role dropdown set to Subscriber
User Restriction unlocks content automatically for logged-in users with the right role.
  1. Lastly, in Overwrite Defaults, you’ll be able to change the form headline, description, placeholder, and button texts for your shortcode.
The Overwrite Defaults toggle enabled with custom Headline, Instruction, and Button Label fields for one specific protected item
Overwrite Defaults customizes the form texts for a single page or area without changing the global settings.
  1. Once you’ve made all your changes, click Update, and your shortcode will be updated too (you may need to refresh the page to see changes).
  1. Once done, copy the shortcode, and we’ll move on to the next stage.

We’ve created our protected area and decided how we want to protect it, so now, let’s get it added to a page/post.

Add your shortcode to a page/post

Adding this shortcode and therefore your protected area to a page or post only takes a few steps:

  1. From your WordPress dashboard, go to Pages > All Pages and click to edit the page you want to add your protected area to.
    • Of course, at this stage, you could also create a new page/post and then take the same steps below.
  2. Next, click within the content area itself and paste the shortcode. WordPress should automatically turn it into a shortcode ‘block’.
  1. If this doesn’t work, instead, click inside the content area and click the black + symbol. Search ‘shortcode’ in the search field that pops up and click on it to add. Then paste your shortcode into the shortcode ‘block’.

Once done click Update at the top of the page and your protected area will appear.

The default Passster protection form with the purple Protected Area headline, standard instruction text, password field, and purple Unlock button
The Passster password prompt shown to visitors before they unlock the content.

Using the Protected Area Block

You can also use the “Protected Area” block right within the Block Editor to select a protected area:

The WordPress block editor with a Passster Protected Area block selected, showing an area dropdown set to Members Area inside a highlighted block
The Protected Area block drops a protected section anywhere in the block editor, with no shortcode needed.

Once added you can select a protected area by clicking on the password form and using the select menu on the right side of the screen. You can also create a new area and quickly update the list of available areas without reloading the page:

You can also edit all labels and texts for that area directly within the block editor by clicking on the individual sections within the password form. Let’s say you want to modify the headline of that specific password form, click on the headline:

A customized Passster protection form with a Members Only headline, custom instruction text, password field, and an indigo Enter button with rounded corners
The protection form fully rebranded: custom headline, instruction, button label, and colors.

Didn’t solve it?

Was this page helpful?
0 1