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 5.10.2

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;

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