ACF
Updater::modify_plugins_transient
Called when WP updates the 'update_plugins' site transient. Used to inject ACF plugin update info.
Метод класса: Updater{}
Хуков нет.
Возвращает
Объект. $transient The modified transient value.
Использование
$Updater = new Updater(); $Updater->modify_plugins_transient( $transient );
- $transient(объект) (обязательный)
- The current transient value.
Список изменений
| С версии 5.0.0 | Введена. |
Код Updater::modify_plugins_transient() Updater::modify plugins transient ACF 6.4.2
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;
}