WP_Site_Health_Auto_Updates::test_wp_automatic_updates_disabled() WordPress Method

WP_Site_Health_Auto_Updates::test_wp_automatic_updates_disabled() is a method that was introduced in WordPress 4.8.1. This method allows for the testing of whether WordPress automatic updates are disabled. This is useful for plugin and theme developers who need to ensure that their code is compatible with sites that have automatic updates disabled.

WP_Site_Health_Auto_Updates::test_wp_automatic_updates_disabled() #

Check if automatic updates are disabled.


Return

(array|false) The test results. False if auto-updates are enabled.


Top ↑

Source

File: wp-admin/includes/class-wp-site-health-auto-updates.php

	public function test_wp_automatic_updates_disabled() {
		if ( ! class_exists( 'WP_Automatic_Updater' ) ) {
			require_once ABSPATH . 'wp-admin/includes/class-wp-automatic-updater.php';
		}

		$auto_updates = new WP_Automatic_Updater();

		if ( ! $auto_updates->is_disabled() ) {
			return false;
		}

		return array(
			'description' => __( 'All automatic updates are disabled.' ),
			'severity'    => 'fail',
		);
	}


Top ↑

Changelog

Changelog
VersionDescription
5.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.