Action hook 'deleted_theme'

in WP Core File wp-admin/includes/theme.php at line 98

View Source

deleted_theme

Action Hook
Description
Fires immediately after a theme deletion attempt.

Hook Information

File Location wp-admin/includes/theme.php View on GitHub
Hook Type Action
Line Number 98

Hook Parameters

Type Name Description
string $stylesheet Stylesheet of the theme to delete.
bool $deleted Whether the theme deletion was successful.

Usage Examples

Basic Usage
<?php
// Hook into deleted_theme
add_action('deleted_theme', 'my_custom_function', 10, 2);

function my_custom_function($stylesheet, $deleted) {
    // Your custom code here
}

Source Code Context

wp-admin/includes/theme.php:98 - How this hook is used in WordPress core
<?php
  93  	 * @since 5.8.0
  94  	 *
  95  	 * @param string $stylesheet Stylesheet of the theme to delete.
  96  	 * @param bool   $deleted    Whether the theme deletion was successful.
  97  	 */
  98  	do_action( 'deleted_theme', $stylesheet, $deleted );
  99  
 100  	if ( ! $deleted ) {
 101  		return new WP_Error(
 102  			'could_not_remove_theme',
 103  			/* translators: %s: Theme name. */

PHP Documentation

<?php
/**
	 * Fires immediately after a theme deletion attempt.
	 *
	 * @since 5.8.0
	 *
	 * @param string $stylesheet Stylesheet of the theme to delete.
	 * @param bool   $deleted    Whether the theme deletion was successful.
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 2
  • File: wp-admin/includes/theme.php
Related Hooks

Related hooks will be displayed here in future updates.