What happens when activating a new WordPress theme?

When you activate a new wordpress theme in the dashboard of appearance/themes, switch_theme is called with the to-be-switched theme as the parameter. switch_theme saves the $$sidebars_widgets in the theme_mod-currenttheme option, updates “template”,”stylesheet”, “current_theme” options to be the new theme, adds a new option theme_mods_$newtheme, updates the “theme_switched” to be the old theme, and does the action “switch_theme”(so you can code to implement special functions in that wordpress them activation hook). After calling the switch_theme hook, wordpress redirects to the url: wp-admin/themes.php?activated=true.

If you like my content, please consider buying me a coffee. Buy me a coffeeBuy me a coffee Thank you for your support!

Leave a Reply