is_uninstallable_plugin()
Determines whether the plugin can be uninstalled.
No Hooks.
Return
true|false
. Whether plugin can be uninstalled.
Usage
is_uninstallable_plugin( $plugin );
- $plugin(string) (required)
- Path to the plugin file relative to the plugins directory.
Changelog
Since 2.7.0 | Introduced. |
is_uninstallable_plugin() is uninstallable plugin code WP 6.5.2
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; }