函数原型
is_uninstallable_plugin( string $plugin ): bool
函数描述
Determines whether the plugin can be uninstalled.
是否弃用
未弃用
函数参数
-
$plugin
string
Required - Path to the plugin file relative to the plugins directory.
函数返回值
bool Whether plugin can be uninstalled.
函数位置
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;
}
源码链接
变更日志
| Version | Description |
|---|---|
| 2.7.0 | Introduced. |

