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'd like to test some theme changes on my live site, but I obviously don't want regular users seeing any errors that may arise from it. I'd like to just duplicate my theme folder and if I'm logged in as admin, then that theme is shown to me, otherwise, the old theme is shown to my users.

Is there a plugin to do this?

share|improve this question
You can use Theme Switch and Preview to do this. wordpress.org/extend/plugins/nkthemeswitch – Lee Apr 16 '12 at 22:36
wordpress.org/extend/plugins/theme-test-drive does exactly what you want – ronald Apr 17 '12 at 0:23
up vote 6 down vote accepted

I just wrote this quick plugin and it seems to work. Let me know if there is a better way.


Plugin Name: Theme Switch if Admin
Description: Display different theme to user if logged in as admin
Author: Kyle Barber
    add_filter('template', 'change_theme');
    add_filter('option_template', 'change_theme');
    add_filter('option_stylesheet', 'change_theme');
    function change_theme($theme) {
        if ( current_user_can('manage_options') ) {
            $theme = 'twentyeleven';

        return $theme;
share|improve this answer
Small hint, the plugin User Theme in the official repo have a small plugin for this job, but without options, same solution how this answer. – bueltge Apr 4 '13 at 12:39

You got switch_theme() and current_user_can( 'manage_options' );, which will only trigger for admin accounts.

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.