Featured Image Switch Active WordPress Theme For Specific User

Switch Active WordPress Theme For Specific User

Cabe Nolan Author
Cabe Nolan November 15, 2018


This post was originally created on our sister site WP Cover.
View Original Article

When designing or developing a new feature for a WordPress site it is often helpful to duplicate the theme, make changes in a test theme and then push the changes back to the live theme.  People have developed some sophisticated plugins that allow you to specify which user roles see what theme but in my opinion most of them are over the top for what I typically need.  I don’t want to spend time configuring a plugin and writing unnecessary data to the database when I’m probably going to uninstall the plugin a couple days later.

If you’re like me, you may be looking for a clean piece of code to quickly switch a specific user or users to view an alternative theme.  I have that clean piece of code for you, short and simple.  Simply create a file in your plugins directory and call it whatever you want (maybe theme-switch.php).  Paste in the following code and edit line 11 with your user ID and line 12 with the name of your theme directory.  Save the file, activate the plugin and you’re on your way!

To make it even easier, here is a downloadable version of the above code. You’ll still want to swap out lines 11 and 12 with your appropriate information.

Download File


The post Switch Active WordPress Theme For Specific User appeared first on WP Cover.


Cabe Nolan Author Image
Written by

Cabe Nolan