There are times when you want to show a post or an article to only registered users on your website. WordPress has a unique feature that allows you to display certain posts and pages to registered users only. This feature is called “Private Posts”.
Unlike regular the regular WordPress posts that all your users see, a private post is not visible to your general website visitors. Only users who are registered and logged in and with specific permissions can see them. In this tutorial, we will be going through the process of creating a private post in WordPress.
Before we begin, it is important to note that since private posts are required users to be logged in with special permission, they are not visible to search engines as well as not being visible in your RSS and Atom feeds. If you would like them to be visible in those then you might want to consider using a public post.
What is Private Post?
Before we delve into how to create a private post, we want to understand in more detail what a private post is. Essentially, a private post in WordPress is not visible to the public. Only logged in users with right permissions can see it among your blog posts.
WordPress, like most content management systems, comes with a built-in user ACL (Access Control List) system. This user role and control system is responsible for assigning permissions and capabilities to different user roles. Every user on your WordPress site has a role assigned to them which gives them permissions to do specific tasks on a website. You can extend the permissions given to various users by using a plugin or an extension.
Any user who has the permission to publish a post can write a private post and publish it. The post will be visible to the user and following user roles. Below are the default types of permissions and the differences that come with a new WordPress installation.
- Administrator – This user can create, edit, and delete any private post created by any user on a WordPress site.
- Editor – A user with an editor permission can create, edit, and delete any private posts created by any user.
- Author – Just like the rest a user with the author permission can create, publish, edit, view and delete their own private posts. They cannot see private posts created by other users.
Creating a Private Post or Private Page.
Firstly, just like all the other pages or posts, you need to actually create a new post or page. You can also edit an existing post that you want to make private.
Once you have created the post, you can proceed to go to the post edit screen, you need to click on the ‘Edit’ link next to the ‘Visibility’ option in ‘Publish’ meta box.
You will now see options to make a post sticky, password protected, or private just like in the screenshot below. Go ahead and select private and then click the OK button to continue. You can now continue editing the post or you can save/publish it.
Users who don’t have permission to see private posts will not see it. One important thing to note is that images you add to a private post are not private and can be viewed in media library by other authors. Images can also be viewed by anyone who has the image URL. To change this behaviour you need to use a special plugin to have user permitted images.
We hope this article helped you learn how to create a private page or post in WordPress. We covered the process of creating a private post/page on your WordPress.