On this page
WP_REST_Plugins_Controller::get_plugin_status( string $plugin ): string
Get’s the activation status for a plugin.
Parameters
$pluginstring Required-
The plugin file to check.
Return
string Either 'network-active', 'active' or 'inactive'.
Source
File: wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php. View all references
protected function get_plugin_status( $plugin ) {
if ( is_plugin_active_for_network( $plugin ) ) {
return 'network-active';
}
if ( is_plugin_active( $plugin ) ) {
return 'active';
}
return 'inactive';
}
Related
Uses
| Uses | Description |
|---|---|
| is_plugin_active_for_network() wp-admin/includes/plugin.php | Determines whether the plugin is active for the entire network. |
| is_plugin_active() wp-admin/includes/plugin.php | Determines whether a plugin is active. |
Used By
| Used By | Description |
|---|---|
| WP_REST_Plugins_Controller::does_plugin_match_request() wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Checks if the plugin matches the requested parameters. |
| WP_REST_Plugins_Controller::update_item_permissions_check() wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Checks if a given request has access to update a specific plugin. |
| WP_REST_Plugins_Controller::update_item() wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Updates one plugin. |
| WP_REST_Plugins_Controller::prepare_item_for_response() wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Prepares the plugin for the REST response. |
Changelog
| Version | Description |
|---|---|
| 5.5.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_plugins_controller/get_plugin_status