ACF

Updater::modify_plugins_transientpublicACF 5.0.0

Called when WP updates the 'update_plugins' site transient. Used to inject ACF plugin update info.

Method of the class: Updater{}

No Hooks.

Returns

Object. $transient The modified transient value.

Usage

$Updater = new Updater();
$Updater->modify_plugins_transient( $transient );
$transient(object) (required)
The current transient value.

Changelog

Since 5.0.0 Introduced.

Updater::modify_plugins_transient() code ACF 6.8.8

public function modify_plugins_transient( $transient ) {
	// Bail early if no response (error).
	if ( ! isset( $transient->response ) ) {
		return $transient;
	}

	// Ensure no_update is set for back compat.
	if ( ! isset( $transient->no_update ) ) {
		$transient->no_update = array();
	}

	// Force-check (only once).
	$force_check = ( $this->checked == 0 ) ? ! empty( $_GET['force-check'] ) : false; // phpcs:ignore -- False positive, value not used.

	// Fetch updates (this filter is called multiple times during a single page load).
	$updates = $this->get_plugin_updates( $force_check );

	// Append ACF pro plugins.
	if ( is_array( $updates ) ) {
		if ( ! empty( $updates['plugins'] ) ) {
			foreach ( $updates['plugins'] as $basename => $update ) {
				$transient->response[ $basename ] = (object) $update;
			}
		}
		if ( ! empty( $updates['no_update'] ) ) {
			foreach ( $updates['no_update'] as $basename => $update ) {
				$transient->no_update[ $basename ] = (object) $update;
			}
		}
	}

	++$this->checked;

	return $transient;
}