A client of ours asked how to protect a page on their site from the casual browser and after a bit of trial and error, I remembered WP already has a perfectly acceptable password-protect system.
From the off, I have to say that this isn’t the best way to handle say a membership site but just to stop the casual observer from viewing say, a trade price list – it will do. It also has the bonus of having nothing to do with the ‘Users’ part of WP anyone with the password for this page has access…That’s also its flaw too. But it is simple to change the password and different pages can have different passwords.
So without further ado.
- Create your page. I’m going to assume you know how to do that.
- Next, you’re going to go to the PUBLISH section (top right usually) and click edit in the visibility section.
- Once you’ve done that it’s as simple as selecting ‘Password protect’, entering your super-secret password then clicking publish or if you’ve already published, update.
- That’s it!
Don’t forget to remove the page from the menu if you don’t want casual viewers knowing about the page and you still have the auto add pages turned on. If you don’t you will give them a head start in playing guess the password (you did set a super-secret password didn’t you? No well go and edit the page and do so.)
To take security one stage further you could give your page a random name too.
Like I said earlier I wouldn’t recommend this method for anything really confidential as unless your host protects against it (as we do!) then this isn’t going to stop a persistent person with the right know-how. Finally – you did use a super-secret password, didn’t you?
Note these instructions are related to the current version of WordPress which at the time of writing is Version 5.9.2 I believe this has been a feature for a while and I doubt it will be removed in future but feel free to reach out if you have a problem.