A common requirement for business sites is to have a client login which allow visitors to access private content for them (ie: downloads, screenshots, documents).

I did it in the past and although it worked, I think is a bit messy.

Now I need the same functionality in a new site, and want to know if anyone did it and want to share a nice way to achieve this.

My method was something like:

  1. Create a custom post type for the private content
  2. Create a custom taxonomy for Clients
  3. Hook user_register and add a Client (taxonomy) every time a new user is created
  4. Hook template_redirect and check if it's a single of my custom post type. If it is, check if the logged_in user is in the custom taxonomy for that post. If it is, cool. If not, header('HTTP/1.1 401 Unauthorized');exit;

Any comments?

1 Answer 1


Sound like a nice idea, but when i need a per user customized private section i usually code it based on page template files and create a few pages with these template files fo example, say i have a download page which will show each user the files he can download so my page template would

first check if the user is logged in (if not Unauthorized redirect) then just pull all of the file that user can download.

Your Answer

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

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