Action hook 'delete_plugin'

in WP Core File wp-admin/includes/plugin.php at line 980

View Source

delete_plugin

Action Hook
Description
Fires immediately before a plugin deletion attempt.

Hook Information

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

Hook Parameters

Type Name Description
string $plugin_file Path to the plugin file relative to the plugins directory.

Usage Examples

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

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

Source Code Context

wp-admin/includes/plugin.php:980 - How this hook is used in WordPress core
<?php
 975  		 *
 976  		 * @since 4.4.0
 977  		 *
 978  		 * @param string $plugin_file Path to the plugin file relative to the plugins directory.
 979  		 */
 980  		do_action( 'delete_plugin', $plugin_file );
 981  
 982  		$this_plugin_dir = trailingslashit( dirname( $plugins_dir . $plugin_file ) );
 983  
 984  		/*
 985  		 * If plugin is in its own directory, recursively delete the directory.

PHP Documentation

<?php
/**
		 * Fires immediately before a plugin deletion attempt.
		 *
		 * @since 4.4.0
		 *
		 * @param string $plugin_file Path to the plugin file relative to the plugins directory.
		 */
Quick Info
  • Hook Type: Action
  • Parameters: 1
  • File: wp-admin/includes/plugin.php
Related Hooks

Related hooks will be displayed here in future updates.