do_action( ‘automatic_updates_complete’, array $update_results )

Fires after all automatic updates have run.

Parameters

$update_resultsarray
The results of all attempted updates.

Source

do_action( 'automatic_updates_complete', $this->update_results );

Changelog

VersionDescription
3.8.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    This hook is pretty useful in case you need to perform some stuff after an automatic update gets completed by WordPress. I personally spent a lot of time figuring out how to deal with this feature, especially because I didn’t know what kind of data the $update_results parameter contained.

    So, here’s a working example of how you should use this hook.

    /**
     * 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', 'wpdocs_auto_update_complete' );
    
    function wpdocs_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...
    			 */
    		}
    	}
    }

You must log in before being able to contribute a note or feedback.