is_uninstallable_plugin() WordPress Function
The is_uninstallable_plugin() function is used to check if a plugin is uninstallable. This function is useful for checking if a plugin is uninstallable before attempting to uninstall it.
is_uninstallable_plugin( string $plugin ) #
Determines whether the plugin can be uninstalled.
Parameters
- $plugin
(string)(Required)Path to the plugin file relative to the plugins directory.
Return
(bool) Whether plugin can be uninstalled.
Source
File: wp-admin/includes/plugin.php
function is_uninstallable_plugin( $plugin ) { $file = plugin_basename( $plugin ); $uninstallable_plugins = (array) get_option( 'uninstall_plugins' ); if ( isset( $uninstallable_plugins[ $file ] ) || file_exists( WP_PLUGIN_DIR . '/' . dirname( $file ) . '/uninstall.php' ) ) { return true; } return false; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
2.7.0 | Introduced. |