In this example, we’ll use the is_user_logged_in()
to display a different theme on our website for visitors:
if(is_user_logged_in()) { function wpxss_set_my_custom_theme() { //replace your theme name here return 'your-theme-name'; } add_filter( 'template', 'wpxss_set_my_custom_theme' ); add_filter( 'stylesheet', 'wpxss_set_my_custom_theme' ); } else { // leave the default theme active for visitors }
The template and stylesheet filters are responsible to select the activated theme for the logged-in users.
Here we set the returning theme name for logged-in users to your-theme-name
which you can change to your desired theme name.
Then simply add the above snippet to your custom plugin or child theme.
Was this post helpful?
Let me know if you liked the post. That’s the only way I can improve. 🙂