It’s impossible, because after deactivation your theme isn’t even loaded!
It’s possible, but hacky. Essentially, we unset the action
param, load in the themes admin page & then exit before the redirect-on-success occurs.
add_action( 'switch_theme', 'wpse_60972_theme_deactivate_message' );
function wpse_60972_theme_deactivate_message()
{
$msg = '
<div class="error">
<p>Your theme has been DEACTIVATED</p>
</div>';
add_action( 'admin_notices', create_function( '', 'echo "' . addcslashes( $msg, '"' ) . '";' ) );
unset( $_GET['action'] );
require ABSPATH . 'wp-admin/themes.php';
exit;
}
If the code you posted is verbatim, may I ask why you want do as such? WordPress has it’s own notices for activation & deactivation.
Related Posts:
- How to trigger function on theme delete?
- What hook is the currently active theme’s functions.php file loaded on? [duplicate]
- How to switch theme if the current user is admin?
- get_template_part vs action hooks in themes
- Any official way to create an admin theme?
- How do I create my own admin button and theme settings page?
- How can I log a user out of WordPress before the page loads?
- Check php version before theme activation
- Display a different theme for not logged-in users
- What’s the earliest point I can get the queried object ID?
- How can I remove “Proudly powered by WordPress” from twentyeleven without modifying footer.php?
- Remove action within a class in a parent theme from the child theme
- Use latest jQuery in WordPress (admin interface)
- Exclude stylesheet from admin
- Filter or action hook to insert content on admin pages before tag
- How get Themes list via REST api?
- Activate a new WordPress Theme Only for Admins
- Delete database tables on theme uninstall?
- How can I show more than 15 themes at a time in the admin menu?
- How to load a different theme for categories?
- add_action in functions.php, do_action in plugin?
- How do you get thumbnails to show up in the admin edit post?
- Theme Development Admin Area [closed]
- Posts and Pages not showing on admin, but showing in theme
- Trigger a custom function when option are saved in admin area
- How can I add class to every quote element?
- Redux callback action
- Switching content between summer and winter
- How can we hide the parent’s theme url at the child themes details on a multisite?
- after_setup_theme is called three times
- It’s okay if I do not write add_action()
- Is it good practice moving the main stylesheets after the plugin styles?
- Use remove_meta_box conditionally on custom post type
- How to get menu location in wp_update_nav_menu hook
- How do I add some javascript validation to the admin interface form’s onsubmit?
- Translate a site based on different themes
- Passing dynamic options from backend to frontend
- Problems to disable the comments for my statics pages
- How to reset a custom theme
- Theme javascript/css 404
- Can not add admin notices from the edit_user_profile_update hook (notices not being displayed)?
- Can I easily switch themes on a fully built website? [closed]
- Switching Theme and back will reset the previous Theme’s settings?
- How to include stylesheet in custom admin using parent_slug
- I made new theme directory, why won’t it show up in admin GUI?
- Fix warning: Missing argument
- Is there any way to modify images from a theme using the web interface?
- Can we change the hook firing sequence?
- Set custom directory in theme for page templates
- Hooking into the HTML header container
- Webflow Interactions on WordPress site?
- Don’t prepend WordPress base url to image paths
- Ensure Quality Transition to New WordPress Theme [closed]
- wp_login_form() ignoring login_form action hook
- ‘Conflict’ with action deleted_post and is_admin()
- Warning: call_user_func() expects parameter 1 to be a valid callback
- Are immediately-called actions not usable in themes?
- How to allow users to switch to the child theme from front end without plugin?
- How to remove the option data of a theme when that theme is removed?
- Where can I find the “add_action()” inside a theme?
- Adding a wp_head hook from an included PHP file
- Fatal error Class-wp-hook, again, but not sure what’s triggering it
- Using OOP in themes
- Get a list of all registered actions
- how to limit search to post titles?
- Undefined offset: 0 in > […] /wp-includes/capabilities.php on line 1067
- register_theme_directory and broken deploys
- Count singular post views automatically
- Migrating October CMS to WordPress
- Why are my sidebars not registering in unit tests
- template_redirect not being called when using ajax
- Theme editor not showing correct index.php
- PHP Parse error: syntax error, unexpected end of file, expecting elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF) on line 230 [closed]
- Retina JS not working
- Get WordPress to use another custom “author.php” file (“custom-author-file.php”)
- wp_add_inline_style() not working?
- How to use one theme for multiple WordPress sites?
- Add sub menu page in your plugin
- Call Web Services on post first publish
- Interpretation and explanation of register sidebar
- WordPress wraps span tags into p tags
- Replace admin header logo with an image
- How to make a function occurs for one time?
- remove theme’s name from dashboard .. How?
- how to stop a gallery slideshow
- Theme seems to be preventing me from adding a new page to my site
- WordPress margin issues
- Remove style id inline CSS in WordPress
- How to find file that placed a line in my header
- Changing admin Textarea to integrated WP editor
- Line break no working on theme
- Orion theme (from theme forest) [closed]
- Diagnosing a connection reset problem
- Boldy theme – Regarding the images above the boxes
- Symbolic Links for themes – linking one theme to many wordpress installs
- Fatal error: Call to undefined function get_header() and BuddyPress [closed]
- which theme is this? [closed]
- JQuery Error in theme for .live is not a function [closed]
- Cannot modify header information – headers already sent
- Is there a hook that I can use when a fatal error occurs?