Skip to main content
in case somebody will copy the code and short php tag is not allowed, it might cause some problems, so better take general <?php which works in both cases
Source Link

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

<?php

/*
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;
    }

?>

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;
    }

?>

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

<?php

/*
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;
    }
Added plugin header
Source Link
Kyle
  • 1k
  • 4
  • 15
  • 28

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;
    }

?>

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

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;
}

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;
    }

?>
Source Link
Kyle
  • 1k
  • 4
  • 15
  • 28

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

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;
}