Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Pretend another theme is active in the WP dashboard to maintain access to everything when something in your theme messes everything up (or whatevs).
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
You can’t perform that action at this time.