I'd like to show certain content to people with a password, specifically links to media files like this:

<?php if($currentuserid == foobar): ?>
   <a href="PROTECTED/CONTENT.pdf">LINK</a>
<?php endif; ?>

If I were to create a user with ID foobar, and then give its password to several people, would it cause any problems if they all decided to use it at once?

I would only want to use their logged-in status to show/hide certain content - they would not be accessing the admin side.

  • I don't foresee this being a problem.
    – Matt Royal
    May 28, 2014 at 11:43
  • Cool, thanks! If you could explain why, a bit, and write it in an answer, I'll happily accept. May 28, 2014 at 11:45
  • You should try to implement password protection for the attachment post type. I'm pretty sure that you could unregister the "Save" meta box in the media library edit screen and replace it with the one from for example the "post" post type. Then check for post_password_required() in your template. No need to add a user account for that.
    – kaiser
    May 28, 2014 at 11:52
  • I would, but wouldn't this mean accessing the files on a post-by-post basis (instead of globally)? Additionally, my client wants to track downloads which is fairly easy to do by tracking logins. May 28, 2014 at 12:00

1 Answer 1


When logging into WordPress with a user account, WordPress checks your credentials against those stored in the database. If they are correct, it then sets a session variable in your browser and you are able to view all areas that check against this session variable to gain access to.

Sessions are set on a per browser basis so it does not matter how many browsers are accessing the site as they will each have this session created on their own browser if their credentials successfully authenticate.

You would only run into problems if for example multiple users were trying to write to the database at the same time for example but in your case there is no admin access so for viewing purposes only, not problem.

Hope this explanation makes sense :-)

  • It does. I was just a bit worried that it might, I don't know, like, knock the planets out of alignment or something. May 28, 2014 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.