WP_REST_Plugins_Controller::get_plugin_status()protectedWP 5.5.0

Get's the activation status for a plugin.

Method of the class: WP_REST_Plugins_Controller{}

No Hooks.

Return

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

Usage

// protected - for code of main (parent) or child class
$result = $this->get_plugin_status( $plugin );
$plugin(string) (required)
The plugin file to check.

Changelog

Since 5.5.0 Introduced.

WP_REST_Plugins_Controller::get_plugin_status() code WP 6.5.2

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