ACF

Updater::clear_transients_on_upgradepublicACF 6.5.1

Clears ACF plugin update transients when ACF is updated.

This method is hooked to the upgrader_process_complete and will delete the 'acf_plugin_updates' transient when the ACF plugin is updated, ensuring fresh update data is fetched on the next check.

Method of the class: Updater{}

No Hooks.

Returns

null. Nothing (null).

Usage

$Updater = new Updater();
$Updater->clear_transients_on_upgrade( $upgrader_object, $options );
$upgrader_object(WP_Upgrader) (required)
The upgrader instance.
$options(array) (required)
Array of update details including:
  • 'action' (string) The action performed (e.g., 'update').
  • 'type' (string) The type of update (e.g., 'plugin').
  • 'plugins' (array) Array of plugin basenames that were updated.

Changelog

Since 6.5.1 Introduced.

Updater::clear_transients_on_upgrade() code ACF 6.8.8

public function clear_transients_on_upgrade( $upgrader_object, $options ) {
	// Check if this was a plugin update
	if ( $options['action'] === 'update' && $options['type'] === 'plugin' ) {
		// Check if we were one of the updated plugins
		if ( isset( $options['plugins'] ) ) {
			$acf_basename = acf_get_setting( 'basename' );
			if ( in_array( $acf_basename, $options['plugins'], true ) ) {
				$plugin    = $this->get_plugin_by( 'basename', $acf_basename );
				$plugin_id = $plugin ? $plugin['id'] : false;
				$this->refresh_plugins_transient( $plugin_id );
			}
		}
	}
}