Remove directory and files of a plugin for a list of plugins.

Signature

delete_plugins( $plugins, $deprecated = '' )
plugins
 (array) List of plugins to delete.
deprecated
 (string) Deprecated.
Default: ''

Return

(boolean|null|WP_Error) True on success, false is $plugins is empty, WP_Error on failure. Null if filesystem credentials are required to proceed.

Source

function delete_plugins( $plugins, $deprecated = '' ) {
	global $wp_filesystem;

	if ( empty($plugins) )
		return false;

	$checked = array();
	foreach( $plugins as $plugin )
		$checked[] = 'checked[]=' . $plugin;

	ob_start();
	$url = wp_nonce_url('plugins.php?action=delete-selected&verify-delete=1&' . implode('&', $checked), 'bulk-plugins');
	if ( false === ($credentials = request_filesystem_credentials($url)) ) {
		$data = ob_get_contents();
		ob_end_clean();
		if ( ! empty($data) ){
			include_once( ABSPATH . 'wp-admin/admin-header.php');
			echo $data;
			include( ABSPATH . 'wp-admin/admin-footer.php');
			exit;
65 more lines...
WP Trac GitHub

Link here