I am developing a theme for a client who has a catalog of products. Each product has a spec sheet that he wants to make available to logged-in users. It's not a real security issue, just a means to simplify the page for casual visitors. Right now he emails clients a password and keeps track of logins based on which password he gave out. He'd like to continue doing that.

So I'd like to come up with a way of:

  • logging a user in with a single field
  • using is_user_logged_in() and related inquiries to check whether to display links to the protected content
  • denying such visitors access to the Admin side completely

Is this out of the scope of WP user roles? If not, any suggestions on how I could achieve this?

1 Answer 1


I would approach the situation like:

  1. Create an user with subscriber role.
  2. Add a meta field to the user profile. This will be the password like field you will verify the user against.
  3. Use AJAX to verify the password(meta value) entered by the visitor and display product specification accordingly.

You do not have to worry about WP user roles or visitors getting access to admin side. Hope this helps!

  • Thanks, Sri! But in that case, why create a user at all? My justification for having an actual login would be that it would persist across the many different pages. May 29, 2014 at 10:48
  • You do not have to create an User, it is just one way out of a million ways. You could create a meta key/value pair(directly on the database) and ask your website visitor to enter the meta value upon visiting the website(may be with a pop up).If the entered value is correct then with the help of PHP session variables you could show product specification just for that session!!!
    – sri
    May 29, 2014 at 10:56
  • This way every time you change the password( the meta value ) you need to interact with the database(assuming you do not have any user interface for this field), which i think is not a easy way for your client! So adding a meta field option for an user account would give your client some GUI to alter the password I suppose.
    – sri
    May 29, 2014 at 11:00
  • 1
    Great points, Sri. I think adding these passwords in an Options page would be the perfect solution. May 29, 2014 at 11:12

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.