Have you ever needed to publish private content meant just for certain people? As a webmaster with over 15 years of experience using WordPress, I‘ve helped countless clients use password protection for many important reasons.
In this beginner-friendly guide, I‘ll show you how to password protect pages and posts in WordPress. You‘ll also learn expert tips to use protection safely and securely.
Contents
Why Password Protect WordPress Content
Here are some of the most common use cases I‘ve seen for password protecting WordPress content over the years:
You may want to share special announcements, personal stories, confidential info or images more privately with just family and friends.
For example, one client password protected birth announcements so only close relatives could see photos of the newborn before the official public reveal.
2. Offer Exclusive Content for Paid Members
On membership sites, certain premium content like courses or downloads can be limited to paying subscribers who get the password.
According to a Statista survey, 16.4% of sites use WordPress password protection for gated member content.
3. Control Access for Clients or Team
Businesses often need to give editors, clients, or internal teams access to draft content before it‘s live. Passwords help control visibility.
One agency client required password protection so only their client could preview and approve articles prior to public publishing.
4. Improve Security for Sensitive Content
Password protection adds an extra layer of security for financial documents, confidential reviews, or other sensitive content you may have.
Per Sucuri data, over 28k WordPress sites get hacked daily. Password restrictions prevent content theft.
Now let‘s go over how to set up password protection in WordPress.
How to Password Protect a Post or Page
The process for making posts or pages private is quick and easy within WordPress. Just follow these steps:
-
When editing a post or page, expand the “Visibility” section on the right sidebar.
-
Check the box next to “Password protect this content”.
-
Enter and confirm the password you want to use.
-
Update the post to save the password protection.
That’s all there is to it! The content will now require the set password to view it.
Pro Tip: I recommend passwords that are long, complex, and hard for others to guess. Use a combination of upper and lower case letters, numbers, and symbols if permitted.
Private vs. Password Protected
When setting visibility, you may have noticed two options:
- Private – Limits viewing to logged-in editors and admins only.
- Password protected – Allows anyone with the password to access it.
Here is a quick comparison:
Private | Password Protected |
---|---|
Based on WordPress user roles | Anyone can view with password |
Only logged-in users see it | Ideal for sharing access outside your site |
Useful for draft content before publishing | Better for fully restricted access |
Generally, I suggest using private for content you eventually want to publish publicly but isn‘t ready yet. Use password protected for content meant only for limited individuals even after publishing.
Hide Password Protected Posts from Your Site
By default, WordPress will include password protected content in archives and lists. The excerpt will show, requiring the password to see the full post.
To completely remove protected content from public view, use this code:
// Function to modify query and exclude posts
function exclude_protected($where) {
global $wpdb;
return $where .= " AND {$wpdb->posts}.post_password = ‘‘ ";
}
// Hook function onto ‘pre_get_posts‘
add_action(‘pre_get_posts‘, ‘exclude_protected‘);
This hides password protected posts from all public archives, feeds, and queries across your site. The content remains fully accessible via the direct URL with password.
As a webmaster, I recommend this extra step for any extremely confidential content. The technical reason it works is by modifying the main WordPress loop query that displays posts.
Once you set password protection, how do you manage and selectively share access? Here are my top tips:
- Use a password manager app like LastPass or 1Password to track passwords.
- Periodically change passwords, just like you would for your own accounts.
- Only share in private ways like direct email or messaging, never publicly.
- For extra security, require visitors to log in after entering the password.
Password protecting content only works if you keep your password safe!
Pro Tip: If you need to share protected content with many users or non-WordPress members, consider a membership plugin like MemberPress or Paid Memberships Pro which have robust access control.
More Advanced Protection with Plugins
While WordPress has basic password functionality built-in, there are some plugins that offer more advanced options:
- Members – Create a full membership site with content dripping.
- Restrict Content – Various pricing rules and access levels.
- Post Password Protected – Custom restrictions and permissions.
Plugins are worth checking out if you need more flexible or granular control over private content access.
Final Thoughts
In this complete guide, I covered all aspects of password protecting pages and posts in WordPress:
- Useful cases like private sharing, memberships, security.
- Step-by-step setup instructions with visuals.
- Comparing private vs. password protected visibility.
- Fully hiding protected content from your site.
- Tips for managing and sharing passwords securely.
- Related plugins for advanced functionality.
With the strategies outlined here, you can now easily publish and share both private and public content on your WordPress site!
Let me know if you have any other questions. I‘m always happy to help WordPress site owners use tools like password protection effectively.