diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index dcad28d90f..90b835fb7a 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -400,6 +400,21 @@ function is_plugin_active( $plugin ) { return in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) || is_plugin_active_for_network( $plugin ); } +/** + * Check whether the plugin is inactive. + * + * Reverse of is_plugin_active(). Used as a callback. + * + * @since 3.1.0 + * @see is_plugin_active() + * + * @param string $plugin Base plugin path from plugins directory. + * @return bool True if inactive. False if active. + */ +function is_plugin_inactive( $plugin ) { + return ! is_plugin_active( $plugin ); +} + /** * Check whether the plugin is active for the entire network. * diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php index d22ea0cbf2..14318074cf 100644 --- a/wp-admin/plugins.php +++ b/wp-admin/plugins.php @@ -186,7 +186,7 @@ if ( $action ) { //$_POST = from the plugin form; $_GET = from the FTP details screen. $plugins = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array(); - $plugins = array_filter($plugins, create_function('$plugin', 'return !is_plugin_active($plugin);') ); //Do not allow to delete Activated plugins. + $plugins = array_filter($plugins, 'is_plugin_inactive'); // Do not allow to delete Activated plugins. if ( empty($plugins) ) { wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); exit;