Creating a central login page for your WordPress password protected categories
There are two ways for visitors to log into your WordPress password protected categories:
- When they visit a password protected 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 on your 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.
How do I create a Central Login Page?
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:
You can then link to this page as you require, e.g. adding the page to your main menu, etc.
Can I customize the message in the category login form?
By default, the message that you have entered on the plugin settings page will appear above the password login form. You can override this for each individual login form by adding
message="your message here" to the login form shortcode. For example, the following shortcode will add a password protected category login form with the text “Please enter your password below:”
[category_login message="Please enter your password below:"]
Can I create a popup login form?
We have tested the
[category_login] shortcode with some free WordPress popup plugins, which we have described below. Use one of these with the Password Protected Categories to create a popup login form.
Whichever popup plugin you use, we recommend setting up the popup to only appear outside of your protected category pages. This prevents it from popping up again after your users have unlocked a category.
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.
Popup Builder by Sygnoos
The free Popup Builder plugin by Sygnoos works with the category 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 a user. It’s best not to tick this box to avoid any conflicts with the ‘Password Expiration‘ setting in Password Protected Categories.