WordPress.org

Make WordPress Core

Changeset 35669


Ignore:
Timestamp:
11/18/2015 05:57:48 PM (6 years ago)
Author:
DrewAPicture
Message:

Plugins: Rename the delete_plugin action hook (introduced in [35094]) to deleted_plugin as it fires following a plugin deletion attempt.

Further, introduce a new delete_plugin action hook, to be fired before a plugin deletion attempt. Both changes bring parity with other such transactional hooks in core that fire before and after certain actions, including on plugin activation/deactivation and install/uninstall, among others.

Props johnjamesjacoby.
Fixes #26904.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/plugin.php

    r35495 r35669  
    817817        }
    818818
     819        /**
     820         * Fires immediately before a plugin deletion attempt.
     821         *
     822         * @since 4.4.0
     823         *
     824         * @param string $plugin_file Plugin file name.
     825         */
     826        do_action( 'delete_plugin', $plugin_file );
     827
    819828        $this_plugin_dir = trailingslashit( dirname( $plugins_dir . $plugin_file ) );
     829
    820830        // If plugin is in its own directory, recursively delete the directory.
    821831        if ( strpos( $plugin_file, '/' ) && $this_plugin_dir != $plugins_dir ) { //base check on if plugin includes directory separator AND that it's not the root plugin folder
     
    833843         * @param bool   $deleted     Whether the plugin deletion was successful.
    834844         */
    835         do_action( 'delete_plugin', $plugin_file, $deleted );
     845        do_action( 'deleted_plugin', $plugin_file, $deleted );
    836846
    837847        if ( ! $deleted ) {
Note: See TracChangeset for help on using the changeset viewer.