A WordPress-centric search engine for devs and theme authors



wp_get_auto_update_message ›

Since5.5.0
Deprecatedn/a
wp_get_auto_update_message ( No parameters )
Returns:
  • (string) The update message to be shown.
Defined at:
Codex:

Determines the appropriate update message to be displayed.



Source

function wp_get_auto_update_message() {
	$next_update_time = wp_next_scheduled( 'wp_version_check' );

	// Check if event exists.
	if ( false === $next_update_time ) {
		return __( 'There may be a problem with WP-Cron. Automatic update not scheduled.' );
	}

	// See if cron is disabled
	$cron_disabled = defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON;
	if ( $cron_disabled ) {
		return __( 'WP-Cron is disabled. Automatic updates not available.' );
	}

	$time_to_next_update = human_time_diff( intval( $next_update_time ) );

	// See if cron is overdue.
	$overdue = ( time() - $next_update_time ) > 0;
	if ( $overdue ) {
		return sprintf(
			/* translators: Duration that WP-Cron has been overdue. */
			__( 'There may be a problem with WP-Cron. Automatic update overdue by %s.' ),
			$time_to_next_update
		);
	} else {
		return sprintf(
			/* translators: Time until the next update. */
			__( 'Auto-update scheduled in %s.' ),
			$time_to_next_update
		);
	}
}