The aim here is to make a WordPress post or page private. (Not the whole site. To make the whole site private, see link below.) That means no one can see it, even if they know the URL.
Actually I want to make all the pages/posts within a category to be private. So let’s go …
The only person who can see the private post/page will be you (and anyone with admin or blog editor permission). And only when you are logged in.
When you are logged in (to WordPress), you will see your private pages/posts in both your admin dashboard area and when viewing your site as a user.
For simplicity, I will write this article as if there is only a single (admin) user.
The Scenario:
- I want to be able to write multiple WordPress posts/pages and make them invisible to everyone but myself. And I can only see them if I am logged into my WP (admin) site.
- Even if others knew the URLs, all they would see would be 404 Error Page Not Found messages.
- I want to be able to put all my private pages/posts under one category. This will make it easier for me to find my private posts when I am viewing my site as a (logged in) user.
Solution:
This is a workaround solution. WP is unable to make a category private – which would be so much easier. So we have to work around that.
Make New Category
Make a new category. I would suggest that this category contains only private posts/pages.
In this example, I will create “Private Category” as the new category. (You can name yours whatever you like).
Make Private Post/Page
Create a new post. You should then be in the edit post mode.
On the right hand side, under “Publish”, you will see that by default, your post has Visibility = Public
Click on the “Edit” link >> select Private >> OK
When Visibility = Private, post is private.
By doing just this, when you publish, only you (when logged into WP) will be able to see the post.
The next question is, if you have a number of private posts, how will you find them when you are viewing your site (rather than being in the admin area)?
For that, we will use the new category we created before: “Private Category”
On the right hand panel of the post you are creating, under
To View your Private Posts
Now that you have your private posts with:
- Visibility = Private
- Category = “Private Category”
how do you view this category?
There are a number of ways of doing this, but I shall show only show the one I am using at this time.
Create New Menu
When you have published your private page(s) under “Private Category”, create a custom menu to contain only this category.
For this example, I have created a menu called: “Private Menu”.
And then put the category “Private Category” into this menu.
Use Widgets to Postion Menu
Next, I will place my “Private Menu” at the bottom of my sidebar. I will do this using the “Custom Menu” widget.
Addendum (27 Apr 2019): The “Custom Menu” is now called “Navigation Menu”
Please note that I will put it below “Recent Posts”. You can put it anywhere of course.
Once the widget is in place, you can configure it.
Note: The Title is optional. If you enter text there, that will appear on your page. I have left mine blank.
Tip: Click the “Visibility” button to specify the conditions when this will only show. For example, I specified: Show if User is Logged In (because there is only one person who logs in at my site, and that is me!) So I myself will only see it when I am logged in.
Now when you view your site, the “Private Category” (which is in the “Private Menu”) will be shown in the sidebar. For my example, it is under “Recent Posts” as alluded to above.
Anyone other your (logged-in) self, who clicks on that link will only see a “Page Not Found” error message.
Your Comments? Tips to share?