WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I only want a post to be viewable by the administrator and one user. (So I would have a post for each user)

I am thinking of using the Members plugin and meta-data/custom fields to restrict the content. This would effectively make the post private to only those with access and any one else would not even see the post and if they get the url, they will be denied.

So would using the Members plugin be the best choice or should I try a different method? and how?

share|improve this question
up vote 2 down vote accepted

I am not expert on users, simplest way as for me would be to store ID (or IDs) of user in custom field and check for it if user is not admin.

Some example code (not tested):

if(current_user_can('administrator') || in_array(get_current_user_id(), get_post_meta(get_the_id(), 'allowed_users', true))) {

else {

    echo 'Post restricted';
share|improve this answer
Thank you Rarst. I implemented a solution similar to the one you provided. – imHavoc Jan 28 '11 at 4:07
Any chance you could share with us the solution you implemented, @imHavoc? – Beto Frega Nov 1 '11 at 16:59

Why don't you use plugin such as Role Manager? You can do that easily. =)

share|improve this answer
Can you link me to this plugin? I cannot find it in the WP Plugin Directory. Also note, I do not want to create a new Role for every user. – imHavoc Dec 28 '10 at 3:48
im-web-gefunden.de/wordpress-plugins/role-manager You can specific users' roles in group. – Luis Dec 28 '10 at 3:58
That's not quite what I am looking for. Each user will have their own post/multiple post. But those posts will be exclusively available to them and administrators. – imHavoc Dec 28 '10 at 16:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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