A WordPress-centric search engine for devs and theme authors



is_uninstallable_plugin ›

Since2.7.0
Deprecatedn/a
is_uninstallable_plugin ( $plugin )
Parameters:
  • (string) $plugin Path to the main plugin file from plugins directory.
    Required: Yes
Returns:
  • (bool) Whether plugin can be uninstalled.
Defined at:
Codex:

Whether the plugin can be uninstalled.



Source

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;
}