WP_REST_Plugins_Controller::get_plugin_status() WordPress Method

The WP_REST_Plugins_Controller::get_plugin_status() method is used to get the status of a plugin. This is a method of the WP_REST_Plugins_Controller class.

WP_REST_Plugins_Controller::get_plugin_status( string $plugin ) #

Get’s the activation status for a plugin.


Parameters

$plugin

(string)(Required)The plugin file to check.


Top ↑

Return

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


Top ↑

Source

File: wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php

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


Top ↑

Changelog

Changelog
VersionDescription
5.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.