At first, you should active the WordPress Debug mode to get the error after implement your code. The code should work, also tested on my environment. I use it on a client installation and works really well. See my source below. It is important that you use the right string for the theme slug, like here popper
. You should also use this code as a plugin in the installation, not inside a theme. Also, the hint, if your installation is a Multisite – the theme must be usable for each site, their use the small plugin to switch the theme.
add_filter( 'template', 'fb_change_theme' );
add_filter( 'option_template', 'fb_change_theme' );
add_filter( 'option_stylesheet', 'fb_change_theme' );
add_filter( 'pre_option_stylesheet', 'fb_change_theme' );
function fb_change_theme($theme) {
if ( current_user_can( 'manage_options' ) ) {
$theme="popper";
}
return $theme;
}
Related Posts:
- 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?
- How can I show more than 15 themes at a time in the admin menu?
- 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
- How to display message (with switch_theme hook) after deactivating My theme?
- How can we hide the parent’s theme url at the child themes details on a multisite?
- How to switch theme if the current user is admin?
- 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
- 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?
- How to change background color in the Notepad++ text editor?
- What are all the available parameters for query_posts?
- How do I change the header image height in Twenty Seventeen?
- Is it OK to remove theme credits from footer? [duplicate]
- What theme is good for posting code? [closed]
- Difference between stylesheet_directory and template_directory
- How to see files in directories in “Edit Themes” screen
- WordPress generating 404 on .mp4 file in theme folder
- Why are my widgets not saving when being added to a sidebar?
- Building useful features into your theme
- How to remove “Proudly powered by WordPress” in Twenty Sixteen (2016) theme?
- Editing theme files and access to the Code pages only to super-admin?
- Edit theme wp_head
- Current theme broken – after server and domain migration
- Enqueue different stylesheets using IE conditionals
- Categories for Pages Not Saving in Admin with Custom Categories Metabox?
- Switch Theme Through Options Panel
- Weird post pagination url redirect
- Extra themes – ok or bad?
- WordPress AJAX in header.php
- Theme Customizer – How to create a sub panel
- Setting a static home page and blog page without using the settings
- Can’t Install Child Theme “The parent theme is missing. Please install the “Default” parent theme.”
- Use a different template/theme if mobile only on home page
- Can i have a single wordpress site to have two themes ( one for pc other for mobiles)
- Translated my theme (translation not showing up)
- How to use get_page_by_title() with qTranslate?
- Changing $before_widget for certain widgets
- wp theme.. Could not create directory
- Multi-level page hierarchy
- How to conditionally display widgetized areas in theme customizer?
- How prevent someone from opening my theme directory
- loss of theme options while site deployment in production
- How to install WordPress theme and configure it? [closed]
- How do I get rid of or change the footer in my child theme?
- How can I make some themes usable only by admins?
- Categories gone after changing theme / demos [closed]
- Angular integration with homepage
- Own Theme Customizer displays error message when saving, saving still works
- WordPress redwaves-lite theme Comments Quote remove [closed]
- 1 Database for multiple WordPress themes
- Page has a parent and $post->post_parent returns 0
- How to create different navigation for registered users in WooThemes Canvas?
- Selected template is not respected for home page in WordPress
- How to restore file or theme?
- A /proc folder in wp-content?
- how do i in ignore/disable/delete a javascript call from parent in child theme?
- How to install themes with the demo content?
- Jetpack CSS .screen-reader-text breaks mobile menu [closed]
- Error when using ‘continue reading’
- How to update theme to specific version
- Child theme’s stylesheet cannot load [closed]
- Configure new installed WordPress in live server
- Where does WordPress get the theme name from to check for updates?
- Hi everybody, I have a problem of search box
- Changing an image in header.php
- Will I lose the pages I’ve created within a default WordPress theme when adding a new theme?
- Multiple sub directories for theme template pages
- How to get the theme directory URI?
- My blog suddenly can’t find my stylesheet?
- Twenty Ten Theme: Replace the Logo by a picture without moving the code
- How to fix Scrape key check failed on WordPress VPS?
- How to use my .mo file in the Divi child theme instead of file in a parent /builder directory?
- How to fix Gutenberg with SiteOrigin page builder deleting content when editing
- Edit a template while still keeping a Landing Page on the main address
- How to allow users to switch to the child theme from front end without plugin?
- Change whole theme depending on resolution
- post_prev & post_next within same category
- Costum Theme template directoy url problem
- How to find out which template the HTML content comes from?
- What is the general cut-off date for reviewed themes in the WordPress.org repository?
- Include root files into header files
- Commenting in CSS (//) equals “none”? [closed]
- Cannot use some themes within Managed WordPress of Go Daddy [closed]
- How to track your theme usage on the internet?
- How to add Company Logo to Chosen Theme
- What security risk is not having “default” theme?
- Is it possible to dynamically show different themes for different users? [duplicate]
- Why does WP theme not look like promoted? [closed]
- Remove image next to header image on WellExpo theme [closed]
- How do I get rid of the Mindblown and the book recommendations?
- Adding PHP code to single template in 2023 edition of WordPress theme