In this article, we will walk you through the following sections:
- Shortcode global (PCP) passwords
- How to create PCP passwords
- How PCP passwords work
- Unlock multiple protected sections at once
- How to manage PCP passwords
- How to track PCP password usage
- Bypass partial protection with quick access links
Requirements:
- Password Protect WordPress Lite version 1.2.3 or greater
- Password Protect WordPress Pro version 1.1.6 or greater
What are shortcode global (PCP) passwords?
Our PPWP plugin allows you to password protect content sections using the following shortcode.
[ppwp passwords="password1 password2"] Your content [/ppwp]
These passwords – within the “passwords” attribute are stored together with your content – not separately in the database, and so, can’t be tracked by our Statistics plugin. If you want to use the same passwords on another content block, you have to type them again as well. They’re usually referred to as shortcode “inline” passwords.
In order to track and manage shortcode passwords more efficiently, global passwords that can be used across the different posts and content blocks are necessary.
How to create shortcode global passwords
Navigate to Password Protect WordPress >> Partial Protection submenu from your admin dashboard.
Then switch to “Global Passwords” tab and click on “Add New” button.
It will bring up a popup where you can create a new password including these pieces of information:
- New Password: unique, no space, case-sensitive, and limited to 100 characters. You can set multiple passwords at once and input one password per line.
- Label: some extra information for your password, e.g. what it is used for. The label should not contain the following special characters: [ ] ” ‘ % < > ,
- (Password) Type:
- Global (default): anyone with the password can unlock the protected section
- Roles: only specific user roles are able to use the password to access the restricted area
- Let’s say you set a password with type Role (editor)
- Only editors can use this password to view the private part.
- Others, e.g. subscribers, will receive an error message when attempting to enter it into password form.
- Let’s say you set a password with type Role (editor)
- Usage Limit: the maximum number of times a password is used.
- Let’s assume that the usage limit of a password is set to 1. If a user enters that password to unlock the protected content section, others can’t use it anymore.
- This feature proves useful to prevent users from sharing your passwords without permission.
- Password Expiry: Make your password auto-expire after a period of time. In other words, users won’t be able to use that password to access your private section after a given time.
How shortcode global passwords work
ID-based passwords
Once generated, your password will display under the Global Passwords tab corresponding with an ID.
Simply copy the password ID and add it to the [ppwp]
shortcode with pwd
attribute in your content.
[ppwp pwd="3820,3821,3822,3823"] Your protected content [/ppwp]
In this example, your protected content will be unlocked if users input one of the passwords has the corresponding ID number of 3820, 3821, 3822, or 3823.
Label-based passwords
Since version 1.3.0, you can select a global shortcode (PCP) password based on its labels instead of ID. This improvement allows you to select and insert multiple passwords into a shortcode at once.
For example, you can use the following shortcode to select 4 passwords in a screenshot.
[ppwp pwd_label="sample"] Your protected content [/ppwp]
Users can unlock the protected content with one of the passwords has the corresponding ID number of 3820, 3821, 3822, or 3823.
A few things are worth noting:
- You can add as many ids or labels in one shortcode as you want and separate them by a comma (,)
- The global shortcode password works similarly to the “inline” passwords
- If you add these 3 attributes to one shortcode, the content will be unlocked when users enter either password.
Let’s say you use the following shortcode to protect a part of your content.
[ppwp passwords="password1" pwd="3820" pwd_label="sample" ] Your content [/ppwp]
Your users can unlock this restricted area when entering “password1” as well as to use the password with the id “3820” or label “sample”.
Unlock multiple protected sections at once
Since PPWP Pro version 1.2.2, your users can access all protected sections using the same password across different pages, posts, and custom post types.
Let’s say you protect a section in post A and another section in post B with the same password “123”. If you enable this option, which is available in our plugin’s settings page, when users unlock protected section in post A, they can access the private section in post B without re-entering the password.
This feature is applied for both shortcode “global” and “inline” passwords.
How to manage shortcode global passwords
The PCP passwords feature also comes with an easy-to-use interface allowing you to create unlimited passwords and manage all of them in one place. You will have full control over your passwords, including (de)activating or deleting, as well as restricting passwords by usages, time, and user roles.
- If a password is inactive or deleted, the private sections will be locked again with those who have used this password to access.
- If a password expires, no one can use it to access your private sections anymore. However, the partially protected content will still visible to users who have already entered this password until their cookie expires.
How to track PCP password usage
You will need our PPWP Statistics extension for tracking PCP password usage purpose.
Once activating the plugin, navigate to Password Protect WordPress >> Statistics from your admin dashboard and switch to “PCP Password Usage” table.