here is no specialized hook for this. However the hook switch_theme
should work for you.
/**
* Switches current theme to new template and stylesheet names.
*
* @since unknown
* @uses do_action() Calls 'switch_theme' action on updated theme display name.
*
* @param string $template Template name
* @param string $stylesheet Stylesheet name.
*/
function switch_theme($template, $stylesheet) {
update_option('template', $template);
update_option('stylesheet', $stylesheet);
delete_option('current_theme');
$theme = get_current_theme();
do_action('switch_theme', $theme);
}
So you should write custom function that deactivate the theme via hook and activate back, if your done with your task.
add_action('switch_theme', function($theme){
if ( 'Your_Theme_Name' == $theme )
{
// do something.
}
// do others.
return;
});
Related Posts:
- disable active plugins for specific theme
- add_action in functions.php, do_action in plugin?
- Deactivate Plugin on Theme Switch
- Hooking in to replace the Sidebar/Widget areas
- How to get menu location in wp_update_nav_menu hook
- Hooking into the HTML header container
- wp_login_form() ignoring login_form action hook
- Filtering WooCommerce Orders by Category
- Advanced Custom Field DatePicker [closed]
- Fatal error: Call to undefined function cmsms_theme_page_layout_scheme()
- Best place for short bio,image and button [closed]
- All sites themes functions.php have been changed
- Homemade plugin while using Themify Ultra
- Why namespaces are rarely used in WordPress plugins?
- What will happen if i deactivate my visual composer plug in? [closed]
- Finding the URL to be used to check if plugin is installed with a theme
- Theme/Plugin installation through url on button click
- (Big issue) Blog is Getting Down Each day.. what should i do.?
- Custom wordpress Theme and Plugin repository
- do_action() hook into load-(page)
- Howto check version of another plugin and then add a submenu page to it
- WordPress 3.8.3. custom theme – sliders won’t load js/css files
- password_reset hook is not working
- The Hook registration_errors was not called
- How can I position ShareThis buttons manually when using the plug-in? [closed]
- How to require users to login when not logged in
- Hook into existing tinyMCE button
- Error when using plugin QuickCache with plugin Mobile Smart ? [closed]
- Does WP delete deprecated plugin/theme files on plugin/theme upgrade?
- How to get post ID with hooks publish_post, new_to_publish, etc
- Is there any hook for theme activation ? or something similar?
- How to use get_template part in the plugin?
- How can I use get header from within my plugin?
- edit_user_profile and show_user_profile are not firing inside a class
- Template filter for custom taxonomy terms
- How do I find out what is in control over a certain part of a website?
- “No Add Button” for me to customize my WordPress with themes and pluggins
- How do I combine a theme with a plugin
- How can I list all installed plugins/themes/versions from CLI/API?
- My single.php page does not show the related data to the post which is clicked
- Where are theme codes located for WordPress?
- Add sub menu page in your plugin
- how to change automatic placing of social plugins below content?
- Overwrite category head title
- Basic gallery plugin suggestion [closed]
- What exactly happens to function argument availability when using a filter?
- Is there a way to get plugins and themes not built for multisite to work on a network subsite?
- How to check if my wordpress websiste is nulled or not?
- Why does my file_exist check fail?
- Remove specific plugins and themes from the Dashboard->Updates page [duplicate]
- Create a single website with 3 theme options in wordpress
- using do_shortcode
- Combining several CSS files into one for optimization
- Create custom pages with a plugin
- the_post hook is not firing for me
- Why do plugins often ask to add in to templates?
- Deactivate JS Script in Plugin Shortcode
- How to write “alt” tag in image for wordpress code?
- Does heavy theme and plugins affect server’s response time? [closed]
- How to protect WordPress from security scanner [closed]
- How to load different homepage on Mobile.?
- Create a post builder skin in a plugin
- remove_action not removing add_action from constructor
- Plugin Development – Functions or Hooks?
- Proper way to use plugin functions in functions.php
- How do I add some javascript validation to the admin interface form’s onsubmit?
- Can my hooked uninstall class function access a global var declared in main plugin file?
- How to activate a plugin on the activation of a theme?
- Flipping Book PHP Code? Any experience?
- Theme Custom Pages
- Use different single.php file based on condition
- how can I query all wordpress users of a blog
- how can I do something on new user registration?
- WordPress plugin won’t show on some themes
- Turning on output buffering in a wordpress plugin
- Making that Admin Bar transparent or a blue color
- Which wordpress theme is compatible Optima Express theme (real estate inventory) plugin?
- How to Include File from Plugins into Template?
- how to activate a plugin inside a theme
- Hook for page Request?
- Display Plugin Panels Outside of Admin Areas
- Are there action hooks for comments?
- How to remove js ui library added by default by wordpress
- how remove font to increase site speed load
- How to use template_include hook with form submission?
- Adding Plugin Assets to Header
- Add item to the woocommerce dashboard menu from a plugin
- How to execute plugin and theme updates from a web hook / endpoint?
- How to use the pre_option filter before a plugin loads?
- Use $variable from file1.php in file2.php (different file paths)
- What are admin hooks
- How do I add $_SESSION[”] to my wordpress page?
- There has been a critical error on your website – won’t fix no matter what
- How to make a dynamic css class whose name changes every visit to confuse scraper
- Is it possible not to load theme on a specific page in wordpress?
- How to get theme’s info from wordpress.org/themes using api.wordpress.org?
- Override/ignore CSS from active theme as not to interfere with my custom CSS
- I receive taxonomy id
- To perform the requested action, WordPress needs to access your web > server
- How to find the list of custom post type where logged in user is author