Plugin_Upgrader::plugin_info() WordPress Method

The Plugin_Upgrader::plugin_info() method returns an array of information about a plugin. The array includes the plugin's name, version, author, and description.

Plugin_Upgrader::plugin_info() #

Retrieve the path to the file that contains the plugin info.


Description

This isn’t used internally in the class, but is called by the skins.


Top ↑

Return

(string|false) The full path to the main plugin file, or false.


Top ↑

Source

File: wp-admin/includes/class-plugin-upgrader.php

	public function plugin_info() {
		if ( ! is_array( $this->result ) ) {
			return false;
		}
		if ( empty( $this->result['destination_name'] ) ) {
			return false;
		}

		// Ensure to pass with leading slash.
		$plugin = get_plugins( '/' . $this->result['destination_name'] );
		if ( empty( $plugin ) ) {
			return false;
		}

		// Assume the requested plugin is the first in the list.
		$pluginfiles = array_keys( $plugin );

		return $this->result['destination_name'] . '/' . $pluginfiles[0];
	}


Top ↑

Changelog

Changelog
VersionDescription
2.8.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.