You are sort of doing this in a roundabout way. WordPress has a function called switch_theme()
:
add_action( 'setup_theme', 'switch_user_theme' );
function switch_user_theme() {
if ( current_user_can( 'manage_options' ) ) {
switch_theme('twentytwelve');
} else {
switch_theme('twentythirteen');
}
}
The argument is the directory of the theme you want.
I can’t help but think this is a bad idea though. Surely you can do what you need without switching themes constantly?
Related Posts:
- How to display message (with switch_theme hook) after deactivating My theme?
- Any official way to create an admin theme?
- How do I create my own admin button and theme settings page?
- Exclude stylesheet from admin
- How get Themes list via REST api?
- Activate a new WordPress Theme Only for Admins
- How can I show more than 15 themes at a time in the admin menu?
- How to load a different theme for categories?
- How do you get thumbnails to show up in the admin edit post?
- Theme Development Admin Area [closed]
- Posts and Pages not showing on admin, but showing in theme
- Switching content between summer and winter
- How can we hide the parent’s theme url at the child themes details on a multisite?
- Translate a site based on different themes
- Passing dynamic options from backend to frontend
- Problems to disable the comments for my statics pages
- How to reset a custom theme
- Theme javascript/css 404
- Can I easily switch themes on a fully built website? [closed]
- Switching Theme and back will reset the previous Theme’s settings?
- How to include stylesheet in custom admin using parent_slug
- I made new theme directory, why won’t it show up in admin GUI?
- Is there any way to modify images from a theme using the web interface?
- Ensure Quality Transition to New WordPress Theme [closed]
- How to allow users to switch to the child theme from front end without plugin?
- How to Link External jQuery/Javascript files with WordPress
- Am I allowed to license my WordPress theme under the aGPL
- Best way to include Bootstrap in WordPress
- Best practices for a Style/CSS based theme options page?
- How to license my commercial WordPress theme? [closed]
- How to Use WordPress as Static CMS Without Blog Posts
- Jquery in Child Theme
- Changing the visible url path to css & js files
- How to automatically highlight syntax of code in a post?
- Retaining old HTML archives and displaying themes conditionally
- Extra User Profile Field Upload File / Image
- Theme Activation, Create Database Tables
- Alternate header image
- Change logo on each page of University Hub theme [closed]
- How do you manage your theme versions when privately distributing?
- wordpress themes demo file importing problem? [closed]
- How to run word press theme on localhost in Ubuntu OS?
- Does uninstalling a WordPress theme delete its database values?
- Confit theme on WordPress.org
- How to set different settings for a mobile theme?
- Problem after renaming wordpress template file
- 100% width Featured Image Size
- How can I display/hide certain content based on a Theme Option field?
- Make it possible to pick a color theme for specific pages
- How can I use a logo in the header?
- How to create my own sidebar in Twenty Eleven child theme?
- How to find out if page_for_posts is showing (in order to style menu item)
- the_content() is not displaying content, why? [closed]
- Unwanted edit link on front page
- Need help with making a website where user can add products
- My new WordPress theme based on the TwentyEleven theme doesn’t display the front page OR the blog page
- How to add logo in Thematic
- How to create a new copy of a theme currently being used?
- Creating a job board using WordPress (for free)? [closed]
- How to transform a custom made static HTML website to a WordPress website [closed]
- Need to edit themes HTML code
- Issue with theme mod options during domain migration
- FTP + Unable to locate WordPress content directory (wp-content)
- How to add custom JS file in WordPress Child theme with get_theme_file_uri
- How to access theme fonts using custom CSS style? [closed]
- I don’t know how to put a placeholder [closed]
- How to hide title on ‘highlights’ – Themify feature
- WordPress setup one database with two different website?
- Do all themes accommodate all features?
- How to reduce Header at the top of the page
- Custom fields not displaying on front end
- How can i set default pages to a word press theme? it shouldn’t be changed even if i install the theme in different host
- Change “published by”
- how to notify users about new theme updates?
- Theme check warning about text domain
- dynamic image path within a javascript file
- WordPress thinks my custom theme is a theme in the public theme repository
- WP Customize API Checkbox change value
- Updating a theme
- Baskerville Theme – How to use the masonry grid layout on other pages
- Background image not showing up
- How to display post meta data in secure manner
- theme continuous deployment from bitbucket to windows azure
- Changing themes on locally hosted webpages
- Will this js code work in a page template?
- Showing wordpress theme demo at front end
- separate home page into separate pages
- Moving WordPress with Super Skeleton theme
- How can I allow a client to edit certain parts of a static site?
- A problem with functions.php file on my WordPress site
- How to add/edit content Custom Content item in theme
- Is there a WordPress theme for twittstrap? [closed]
- change template with button
- How do I remove the dash (-) between my Site Title and Tagline?
- WordPress Theme redirects to the Index page – Theme customizer problem
- Obtaining the original unchanged Theme [closed]
- How to assign posts to different themes? [closed]
- Using AJAX to Update WordPress Theme
- Help with Divi logo not appearing for 10s
- How to clone a theme template from within WordPress? [closed]