On this page
is_uninstallable_plugin( string $plugin ): bool
Determines whether the plugin can be uninstalled.
Parameters
$pluginstring 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. View all references
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;
}
Related
Uses
| Uses | Description |
|---|---|
| plugin_basename() wp-includes/plugin.php | Gets the basename of a plugin. |
| get_option() wp-includes/option.php | Retrieves an option value based on an option name. |
Used By
| Used By | Description |
|---|---|
| WP_Plugins_List_Table::single_row() wp-admin/includes/class-wp-plugins-list-table.php | |
| delete_plugins() wp-admin/includes/plugin.php | Removes directory and files of a plugin for a list of plugins. |
Changelog
| Version | Description |
|---|---|
| 2.7.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/is_uninstallable_plugin