ACF

Updater::get_plugin_infopublicACF 5.5.10

Returns update information for the given plugin id.

Method of the class: Updater{}

No Hooks.

Returns

Array|WP_Error.

Usage

$Updater = new Updater();
$Updater->get_plugin_info( $id, $force_check );
$id(string)
The plugin id such as 'pro'.
Default: ''
$force_check(true|false)
Bypasses cached result.
Default: false

Changelog

Since 5.5.10 Introduced.

Updater::get_plugin_info() code ACF 6.8.8

public function get_plugin_info( $id = '', $force_check = false ) {
	$transient_name = 'acf_plugin_info_' . $id;

	// check cache but allow for $force_check override.
	if ( ! $force_check ) {
		$transient = get_transient( $transient_name );
		if ( $transient !== false ) {
			return $transient;
		}
	}

	$response = $this->request( 'v2/plugins/get-info?p=' . $id );

	// convert string (misc error) to WP_Error object.
	if ( is_string( $response ) ) {
		$response = new WP_Error( 'server_error', esc_html( $response ) );
	}

	// allow json to include expiration but force minimum and max for safety.
	$expiration = $this->get_expiration( $response, DAY_IN_SECONDS );

	// update transient.
	set_transient( $transient_name, $response, $expiration );

	return $response;
}