You can use the filter stylesheet:
<?php add_filter( 'stylesheet', 'wpse149620_stylesheet' );
function wpse149620_stylesheet( $stylesheet ) {
if ( ! is_admin() && current_user_can( 'administrator' ) ) {
$stylesheet="admin-theme";
}
return $stylesheet;
} ?>
However, this must be loaded before the first time the “current theme” is requested, which can only be done (without editing core) by putting this in a Must Use Plugin.
Create a directory called ‘mu-plugins’ in ‘wp-content’ and insert this code into a PHP file. WordPress will pick this up automatically. Make sure there are no spaces, line breaks or output before the PHP code to avoid a fatal error.
Related Posts:
- Between functions.php (theme), widgets, and plugins, which is loaded first?
- Is there any sort of theme dependency management?
- How do I cleanly override a plugin’s CSS with a child theme?
- Add Plugins to WordPress Theme
- wp_enqueue_scripts not working in custom theme
- What is the correct way for a theme to support plugin UIs?
- How to call “page specific menu items” in template [closed]
- Create WooCommerce Product Category Programmatically
- Function to activate WordPress theme inside a plugin
- Get info (url) from already enqueued styles
- How do I make my wordpress page more friendly for mobile viewers?
- WordPress Enqueue Script Chaos (jQuery & Foundation.js)
- login to wordpress with Get variables instead of Post
- Should I add sharing buttons using a plugin or directly in my theme files?
- Check javascript file Proper way in functions.php
- Should I use RIPS tool to test my themes and plugins?
- How to Build a Movie Library in WordPress 3.x
- resize only height using wp_get_image_editor
- Having separate plugins and themes folder for multi-site setup
- How can I get full attachment url from wp_get_attachment_metadata?
- unzip a folder on specific location and delete the zip file
- Editing Theme to apply Co-Authors Plus
- gallery option is not available in media upload box in costum theme option page
- How to limit WordPress pages during updates?
- Why are some of my thumbnails not being generated?
- Why is the Settings API is not saving my array of options
- Built in audio player?
- How do you remove plugin edit option?
- Override the filter from plugin in child theme
- WordPress logo upload option in theme panel
- Network: retrieve a list of latest posts
- WooCommerce get_price returning wrong price when used via ajax
- Open Post Thumbnail in New Child Theme File in WordPress
- wp_get_post_terms is difference obj model than the one in rest api response
- how to add a button next to the wordpress view button?
- Best place for short bio,image and button [closed]
- What are the specifics of WordPress development I need to know? [closed]
- WordPress shows error related to allow_url_fopen
- How to create a code editor for my plugin .?
- How to show only next post pagination link using wp_link_pages()
- wp_footer hook only working on homepage not in other pages
- Jquery NoConflict Problem
- Redirect to another page using contact form 7? [closed]
- Great blogs site resources/tutorial for WordPress Developers? [closed]
- How to multiply a post to test internal search results?
- Use different single.php file based on condition
- How can I support plugins in a custom theme?
- Redeclare function after plugin activation
- Woocommerce singe product custom gallery output works just on the first slide
- Remove Pagination for Product Category Pages WooCommerce
- How can I use my custom wordpress theme on two websites? [closed]
- Widget for specific category
- How to customize this theme? [closed]
- WordPress API functions not working at AJAX functions.php call
- Don’t load the theme for a page FROM a plugin EDITED
- Extending a theme: build new features as plugin or core modules?
- Hardcode a form in Contact Form 7 [closed]
- Remember the Meta Value With Radio Buttons
- how to design change in woocommerce cart page and all other page also by theme? [closed]
- WordPress plugin with its own “site”/theme
- Override methods in Yoast SEO breadcrumb class
- Theme Functions run a function upon activation or preview
- Removing the custom_image_header from wp_head
- Seperate plugin and theme files
- Xamp installed local wordpress not allowing to publish or install plugin
- Elementor Sidebar not loading when PRO elements plugin is active
- How would I get the new plugin version on this function?
- Newbie problem with adding include wp_footer
- Conditional Homepage for logged in user
- How can I see $post object in frontend from functions.php?
- How to get checkbox by default true in metabox?
- How much PHP and MySQL or MariaDB knowledge should I know to start writing WordPress themes and plug-ins and whatever else a beginner can edit?
- when i activate my WordPress plugin cannot see customizer options or preview
- Is it possible to customize a wordpress post from outside dashboard(Something like site.com/post-type/post/?e=post_id)?
- When the user entered an unauthorized url redirect to login page
- Show content from plugin on index
- Help Code Review – I need to write on .htaccess file from theme’s function.php
- Where do the section input fields values are stored in database
- Get plugin to background of page
- How to display the Facebook like count in WordPress theme [closed]
- How to increase script execution time at my server
- twitter widget loads properly in all themes except my own theme?
- Directory structure for plugin changes
- How to show post attachment image
- Active Plugins for current blog in WP Multisite Network? [duplicate]
- Disqus plugin outputs script as literal text
- How to generate a responsive output from plugin?
- How to work email subscribe in WordPress?
- How to create post comparison in wordpress
- Apostrophes replaced by '
- Editing a theme
- Ajax button “Load more” is not loading correct language version posts for logged out users
- How to code a wordpress page properly? Dashboard or unique Theme files or alternative?
- how to make wordpress remember my choice
- Meta box not displaying on the plugin page
- Getting error when accessing Customizer Page
- WordPress search every time shows no search found even data exists
- How to create new title and its description inside a section in WP Customizer?
- Composer dependency
- I want to move the one click accesbility button on bottom of my website screen,