Creating a login page for your WordPress password protected categories
If you're using the WordPress Password Protected Categories plugin, then you'll need a way for people to log into your protected categories. This will depend on whether you're using password protected or user/role protected categories. We will cover both options below.
Password protected categories login page
There are two ways for visitors to log into password protected categories:
- When they visit a password protected post category (i.e. the category archive) or visit one of the posts inside the category, or one of its sub-categories. The visitor will be shown the login form where they can enter a password. They must enter the correct password for the category to unlock it and reveal the contents.
- From a central login page. The central login page allows the visitor to login to any password protected category in your WordPress site. A login form is displayed on this page where the user can enter a password.
If the user enters a correct password for a category, they will automatically be redirected to that category. The login form will direct them to the first matching category that it finds, so it makes sense to use a different password for each category to avoid any potential conflicts.
Create a central password login page
There are two ways to create a central login page for your password protected WordPress categories. If you only need one login form for your password protected categories, then you should select a page from the 'Password entry page' option on the plugin settings page. The password login form will automatically be added to this page, and you can link to it as required (e.g. from your navigation menu).
The plugin comes with a shortcode that you can use to add login forms anywhere on your site. To do this, simply add the shortcode
[category_login]. You can add it to a 'Shortcode' or 'Paragraph' Gutenberg block, to a text widget, or to the main page content within the classic WordPress editor.
Password login form shortcode options
By default, the message that you have entered on the plugin settings page will appear above the password protected categories login form.
You can override this for each individual login form using the following shortcode options:
heading="Your heading here"- overrides the heading above the password login form.
show_heading="false"- hides the heading above the password login form. This shortcode option is set to "true" by default, so you only need to use it if you want to hide the heading.
message="your message here"- overrides the message displayed above the password entry field.
label=""- overrides the 'Label' text which appears in or next to the password entry field (depending on your theme).
button_text=""- overrides the button text on the category login form.
For example, the following shortcode will create a password login form with all of these options:
[category_login heading="Login Below" show_heading="false" message="Please enter your password below:" label="Enter password" button_text="LOGIN"]
User and role protected categories
The plugin also has options to restrict categories so that they are automatically available to specific logged in users or user roles. With these options, the protected categories will automatically be unlocked whenever a user logs into their account on your website. This means that you don't need a special login form for your protected categories - you just need a normal login form.
This is not part of our plugin, but here is advice on different ways you can allow users to log into their accounts:
- The default WordPress login page at [your-domain.com]/wp-login.php.
- You can create a professional-looking front end user account login form with a plugin such as Theme My Login or Profile Builder.
Whichever method you use for people to log into their accounts, they can access their protected categories after logging in.
Once people have logged in, you will need to consider the best way for them to navigate to their protected categories.
Can people automatically log into a protected category by clicking a link/URL?
This is not possible for password protected categories because the user must enter a correct password to unlock the category. You can achieve this for user or role protected categories by using our plugin with a WordPress auto-login plugin such as Autologin Links.
Can I create a registration page for my protected categories?
Yes, please see our article on how to let people register to access protected categories.
Can I add a popup login form?
You can use Password Protected Categories with several free WordPress popup plugins:
- If you are using the user or role protection options, then you can create a login form using a plugin such as Theme My Login or Profile Builder. This comes with a shortcode that you can use to create a user registration or login form. Install any popup maker plugin, and add the login shortcode to the popup window.
- If you are using password protected categories then we have tested the
[store_login]shortcodes with the following popup marker plugins.
Whichever popup plugin you use, we recommend setting it up to only display the popup outside of your protected category pages and their posts. That way, people will never be shown the login form after unlocking a protected category.
Please note that while you can add a login form to these third-party popup plugins, it's not possible to automatically open a popup when someone clicks on a direct link to a protected category or post. Instead, they will be shown a page containing the password login form (for password protected categories); or the page selected in the 'When logged out' setting (for user or role protected categories).
Popup Maker by Code Atlantic
Code Atlantic's free Popup Maker plugin allows you to choose which pages to add a popup login form to. You can add it to regular WordPress pages .
Once a customer enters their username and password, they can be redirected to either the store or to a specific unlocked category page.
Popup Builder by Sygnoos
The free Popup Builder plugin by Sygnoos works with the password login form in exactly the same way as the Code Atlantic plugin.
It also comes with a 'Popup showing limitation' option which controls how many times the popup will appear to each person. It’s best not to tick this box to avoid any conflicts with the Password Expiry setting in Password Protected Categories.
Hustle Marketing, Social Share, Email Opt-in Form and Popup Plugin
Hustle works with Password Protected Categories in the same way as the other popup plugins listed above.