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?


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.


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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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