I’d like to test some theme changes on my live site, but I obviously don’t want regular users seeing any errors that may arise from it. I’d like to just duplicate my theme folder and if I’m logged in as admin, then that theme is shown to me, otherwise, the old theme is shown to my users.
Is there a plugin to do this?
I just wrote this quick plugin and it seems to work. Let me know if there is a better way.
You got
switch_theme()
andcurrent_user_can( 'manage_options' );
, which will only trigger for admin accounts.