automatic_updates_complete

最后更新于:2021-11-25 20:58:03

do_action( ‘automatic_updates_complete’, array $update_results )

Fires after all automatic updates have run.

参数

$update_results

(array)
The results of all attempted updates.

源文件

文件: gc-admin/includes/class-gc-automatic-updater.php

View on Trac

/**
 * Fires after all automatic updates have run.
 * Completes the update scheduled in background.
 *
 * @param  array  $results  The results of all attempted updates.
 *
 * @since  3.8.0
 */
add_action( 'automatic_updates_complete', 'gcdocs_auto_update_complete' );

function gcdocs_auto_update_complete( $results ) {
	// the list of plugins is contained within the "plugins" attribute
	foreach ( $results['plugin'] as $plugin ) {
		// make sure the plugin slug matches the one assigned to your own plugin
		if ( ! empty( $plugin->item->slug ) && '{plugin_slug}' === $plugin->item->slug ) {
			/**
			 * @todo Plugin found! Do stuff here...
			 */
		}
	}
}