W3cubDocs

/WordPress

WP_REST_Plugins_Controller::get_plugin_status( string $plugin ): string

Get’s the activation status for a plugin.

Parameters

$pluginstringrequired
The plugin file to check.

Return

string Either 'network-active', 'active' or 'inactive'.

Source

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

Changelog

Version Description
5.5.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_plugins_controller/get_plugin_status