Learn how to hide password protected posts in WordPress, ensuring they remain private from the public while still being accessible to clients for review. With a simple code snippet, you can exclude these protected posts from your blog and homepage, offering a seamless workflow where clients don’t need to log into the WordPress admin. This method simplifies the content approval process, boosts security by keeping drafts hidden, and maintains your site’s performance. Share direct links with clients to streamline reviews and feedback without compromising privacy.
Learn how to manage Password Protected blog posts—keeping them hidden from public view, yet easily accessible to clients for review without needing them to log in to WordPress admin.
Managing Password Protected Content Without Public Exposure
When managing blog content, it’s common to have drafts and revisions that need client feedback before publishing. But how do you ensure that these Password Protected posts remain hidden from the general public while making it easy for clients to access them?
By default, WordPress allows you to password-protect posts or make them private. However, clients typically need to log in to your WordPress admin to view these private posts, which complicates the process. They may struggle with the login process, leading to delays and frustrating interactions.
The Solution: Hide Password Protected Posts in WordPress
Instead of relying on the WordPress admin access for client reviews, you can use a simple code snippet to exclude private or password-protected posts from your blog and homepage while providing easy access to clients via a clickable post URL. This keeps your drafts safe from public view but allows clients to review the content without needing to log in.
All the client needs to do is add the password your have told them is being used. To keep it really simple to use, set the password to be the client’s first or company name!

Here’s the code that makes it happen:
<?php// Filter to hide protected posts
function ns_exclude_protected($where) {
global $wpdb;
return $where .= " AND {$wpdb->posts}.post_password = '' ";
}
// Decide where to display them
function ns_exclude_protected_action($query) {
if( !is_single() && !is_page() && !is_admin() ) {
add_filter( 'posts_where', 'ns_exclude_protected' );
}
}
// Action to queue the filter at the right time
add_action('pre_get_posts', 'ns_exclude_protected_action');
This code ensures that password-protected posts won’t show up on the blog or homepage but will still be accessible through direct links that you can send to clients.
Benefits of Hiding Password Protected Posts in WordPress
- Simplified, Client-Friendly Access
Clients can review private content without logging into WordPress admin or navigating a complex dashboard, streamlining the feedback process and maintaining a professional image. - Improved Security
The code snippet hides password-protected posts from public pages, reducing the risk of exposing unfinished content. - Efficient Workflow
Shareable, direct links allow clients to easily access content, cutting down on back-and-forth emails or permissions. - Private Content Protection
Your blog and homepage remain free of draft or protected content, keeping your site clean and professional. - Customizable Visibility
This solution applies only where you choose—ensuring private posts are excluded from the blog feed but accessible to the right people. - Less Overhead
You won’t need to set up separate accounts or permissions for clients, simplifying project management. - Non-Intrusive Implementation
The lightweight code doesn’t affect overall site performance, maintaining speed and user experience.
Need an Expert WordPress Developer?
If you’re looking to implement custom solutions like hiding password-protected posts or optimizing your WordPress site for seamless client collaboration, an expert WordPress developer can make all the difference. Don’t leave your workflow to chance—get professional help to ensure your site runs smoothly, securely, and efficiently. Contact me today to discuss your project and take your WordPress setup to the next level!