Action hook 'delete_theme'

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

View Source

delete_theme

Action Hook
Description
Fires immediately before a theme deletion attempt.

Hook Information

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

Hook Parameters

Type Name Description
string $stylesheet Stylesheet of the theme to delete.

Usage Examples

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

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

Source Code Context

wp-admin/includes/theme.php:82 - How this hook is used in WordPress core
<?php
  77  	 *
  78  	 * @since 5.8.0
  79  	 *
  80  	 * @param string $stylesheet Stylesheet of the theme to delete.
  81  	 */
  82  	do_action( 'delete_theme', $stylesheet );
  83  
  84  	$theme = wp_get_theme( $stylesheet );
  85  
  86  	$themes_dir = trailingslashit( $themes_dir );
  87  	$theme_dir  = trailingslashit( $themes_dir . $stylesheet );

PHP Documentation

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

Related hooks will be displayed here in future updates.