ACF_Updates::modify_plugins_transient()publicACF 5.0.0

modify_plugins_transient

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

Метод класса: ACF_Updates{}

Хуков нет.

Возвращает

$transient.

Использование

$ACF_Updates = new ACF_Updates();
$ACF_Updates->modify_plugins_transient( $transient );
$transient(объект) (обязательный)
-

Список изменений

С версии 5.0.0 Введена.

Код ACF_Updates::modify_plugins_transient() ACF 6.0.4

function modify_plugins_transient( $transient ) {

	// bail early if no response (error)
	if ( ! isset( $transient->response ) ) {
		return $transient;
	}

	// 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
	if ( is_array( $updates ) ) {
		foreach ( $updates['plugins'] as $basename => $update ) {
			$transient->response[ $basename ] = (object) $update;
		}
	}

	// increase
	$this->checked++;

	// return
	return $transient;
}