Support » Plugins » Hacks » Password Protected Posts only for Logged Out Users

  • I have a number of posts, most can only be viewed by a logged in user, but some are password protected for both logged in and non-logged in users to view.

    I need to have the password protected posts so that only non-logged in users need to enter the password, for logged in users the post should just be visible, but I can’t seem to manage this, they still need to enter the password.

    Any ideas?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi. The way you handle this may depend on how many different users with accounts who log-in you need to handle. This page:

    notes that logged in users can view password-protected posts in the “Edit” screen of the post management interface, so if you only have one or two who need to get around the password requirement, this could be a way to do it.

    If you need to handle lots of users and/or it’s important that they view the post in the same way that logged-out users will, you may need to explore using a plugin or even adding custom functionality to WordPress, e.g.

    I hope this helps.

    Hi Chris,

    Thanks for your response! It is important that they can view this in the same way as logged out users unfortunately. I have searched for a plug in but nothing seems to fit my requirements.

    My main problem is I cannot find a way of intercepting the password form/blocking of content, it’s all part of the function of get_the_content (from post-template.php) as here:

    if ( post_password_required( $post ) )
    		return get_the_password_form( $post );

    I can’t find a relevant pluggable function or hook for altering this behaviour, so without editing core files (obviously a no no!), I can’t see a way around it, unless I’m missing a function somewhere.


    Yeah, I think you may be crossing into the realm of needing custom plugin development. As you note, it could get messy to start modifying WordPress’s built-in functionality to do what you want, so I would recommend either building your own plugin or trying to find a plugin developer who could help you build what you want.

    There’s a ticket currently in Trac to add a filter to the post_password_required() function. If this filter is added, it would make it very easy for a Plugin to do what you want to do.

    Ticket link:

    Thank you, Jeremy, I will keep an eye on that, it’d be really useful!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Password Protected Posts only for Logged Out Users’ is closed to new replies.