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 plan to use the member plugin by Justin Tadlock

I wish to know if how could I, on the front side, auto switch to a theme according to a role status.. for example authors would have the site presented using theme 1 while editor would have the site presenter using theme 2

I would rather have 2 different theme rather than conditionals within one theme structure

Thank you in advance

share|improve this question

There's current_user_can( 'CAPABILITY' ); (see @Codex Users & Roles to find the appropriate cap for your targeted role), that you can use to determin what theme you want to display. You can also check for is_user_logged_in() if you just want to differentiate between non-logged in and logged in users. Then you have the switch_theme() function. Just wrap it up in a plugin and add a function that you hook into plugins_loaded or something similar (not sure when the user info is ready). Then switch depending on the role. Sidenote: You can't do that from a themes functions.php file, as the first available hook is after_setup_theme.

share|improve this answer
thank you very much Kaiser, it makes sense that it must be done as a plugin for due to the init prb.. I will play with it and come back whether I'm successfull or encounter trouble... thank you again – Steffy Kristiensen Dec 23 '11 at 14:14
What happens if two different users visit the site simultaneously, with separate them settings? Does wordpress simply display the correct theme on the fly to the right user? – Lucky Luke Dec 22 '15 at 15:11
@LuckyLuke I have never tried switching themes on a per user basis, but as every request is normally a separate PHP process on the server, it should not be a problem regarding the request itself. No idea without testing if it has implications and sideeffects in the database as this function switches options on the fly. Could easily be that this messes up your database as it is not necessarily in sync regarding timing. I think it won't really work well and caching might have impact as well. – kaiser Dec 22 '15 at 23:19
@kaiser thanks for clarifying, you have discouraged me from following this path :) – Lucky Luke Dec 23 '15 at 14:20

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.