Created
March 22, 2019 18:55
-
-
Save hiranthi/2e102de1e0a45ce633aa703663d2491c to your computer and use it in GitHub Desktop.
Pretend another theme is active in the WP dashboard to maintain access to everything when something in your theme messes everything up (or whatevs).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'template', 'onx_change_theme' ); | |
add_filter( 'option_template', 'onx_change_theme' ); | |
add_filter( 'option_stylesheet', 'onx_change_theme' ); | |
add_filter( 'pre_option_stylesheet', 'onx_change_theme' ); | |
function onx_change_theme( $theme ) | |
{ | |
if ( is_admin() && ( function_exists( 'wp_get_current_user' ) ) ) | |
{ | |
if ( current_user_can( 'administrator' ) ) | |
return 'twentynineteen'; | |
} | |
return $theme; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment