wphooks.info - delete_plugin

delete_plugin

(trunk - 5.0-alpha-42177)

The hook occurs in the following file:

wp-admin/includes/plugin.php:
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
			uninstall_plugin($plugin_file);
		}

		/**
		 * Fires immediately before a plugin deletion attempt.
		 *
		 * @since 4.4.0
		 *
		 * @param string $plugin_file Plugin file name.
		 */
		do_action( 'delete_plugin', $plugin_file );

		$this_plugin_dir = trailingslashit( dirname( $plugins_dir . $plugin_file ) );

		// If plugin is in its own directory, recursively delete the directory.
		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
			$deleted = $wp_filesystem->delete( $this_plugin_dir, true );
		} else {
			$deleted = $wp_filesystem->delete( $plugins_dir . $plugin_file );
		}