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

Can I use is_user_logged_in to manage content for different roles?


If subscribevr user is logged in.... show content.... else show "you are not logged in"

and on anonther page

if contributor user is logged in.... show content.... else show "must be logged in or be a contributor so view this content"

Does anybody know a good code I can solve this with?

share|improve this question

This thread at wordpress.org - http://wordpress.org/support/topic/content-shown-based-on-user-role - suggests using the 'current_user_can' function

This thread - http://wordpress.org/support/topic/display-a-custom-image-only-if-user-role-is-contributor - suggests you can use it like 'current_user_can('contributor')' for different roles.

I haven't tried it but it sounds like it should work.

share|improve this answer

Also, this plugin might do the job: http://wordpress.org/extend/plugins/role-scoper/

(Had to add a 2nd answer as I'm a new user and only allowed to add 2 links within my answer)

share|improve this answer

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.