WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_Site_Health::detect_plugin_theme_auto_update_issues() public WP 5.5.0

Check for potential issues with plugin and theme auto-updates.

Though there is no way to 100% determine if plugin and theme auto-updates are configured correctly, a few educated guesses could be made to flag any conditions that would potentially cause unexpected behaviors.

Это метод класса: WP_Site_Health{}

Хуки из метода
Возвращает

Объект. The test results.

Использование

$WP_Site_Health = new WP_Site_Health();
$WP_Site_Health->detect_plugin_theme_auto_update_issues();

Список изменений

С версии 5.5.0 Введена.

Код WP_Site_Health::detect_plugin_theme_auto_update_issues() WP 5.5.1

wp-admin/includes/class-wp-site-health.php
<?php
function detect_plugin_theme_auto_update_issues() {
	$mock_plugin = (object) array(
		'id'            => 'w.org/plugins/a-fake-plugin',
		'slug'          => 'a-fake-plugin',
		'plugin'        => 'a-fake-plugin/a-fake-plugin.php',
		'new_version'   => '9.9',
		'url'           => 'https://wordpress.org/plugins/a-fake-plugin/',
		'package'       => 'https://downloads.wordpress.org/plugin/a-fake-plugin.9.9.zip',
		'icons'         => array(
			'2x' => 'https://ps.w.org/a-fake-plugin/assets/icon-256x256.png',
			'1x' => 'https://ps.w.org/a-fake-plugin/assets/icon-128x128.png',
		),
		'banners'       => array(
			'2x' => 'https://ps.w.org/a-fake-plugin/assets/banner-1544x500.png',
			'1x' => 'https://ps.w.org/a-fake-plugin/assets/banner-772x250.png',
		),
		'banners_rtl'   => array(),
		'tested'        => '5.5.0',
		'requires_php'  => '5.6.20',
		'compatibility' => new stdClass(),
	);

	$mock_theme = (object) array(
		'theme'        => 'a-fake-theme',
		'new_version'  => '9.9',
		'url'          => 'https://wordpress.org/themes/a-fake-theme/',
		'package'      => 'https://downloads.wordpress.org/theme/a-fake-theme.9.9.zip',
		'requires'     => '5.0.0',
		'requires_php' => '5.6.20',
	);

	$type = 'plugin';
	/** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */
	$test_plugins_enabled = apply_filters( "auto_update_{$type}", true, $mock_plugin );

	$type = 'theme';
	/** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */
	$test_themes_enabled = apply_filters( "auto_update_{$type}", true, $mock_theme );

	$ui_enabled_for_plugins = wp_is_auto_update_enabled_for_type( 'plugin' );
	$ui_enabled_for_themes  = wp_is_auto_update_enabled_for_type( 'theme' );
	$plugin_filter_present  = has_filter( 'auto_update_plugin' );
	$theme_filter_present   = has_filter( 'auto_update_theme' );

	if ( ( ! $test_plugins_enabled && $ui_enabled_for_plugins )
		|| ( ! $test_themes_enabled && $ui_enabled_for_themes )
	) {
		return (object) array(
			'status'  => 'critical',
			'message' => __( 'Auto-updates for plugins and/or themes appear to be disabled, but settings are still set to be displayed. This could cause auto-updates to not work as expected.' ),
		);
	}

	if ( ( ! $test_plugins_enabled && $plugin_filter_present )
		&& ( ! $test_themes_enabled && $theme_filter_present )
	) {
		return (object) array(
			'status'  => 'recommended',
			'message' => __( 'Auto-updates for plugins and themes appear to be disabled. This will prevent your site from receiving new versions automatically when available.' ),
		);
	} elseif ( ! $test_plugins_enabled && $plugin_filter_present ) {
		return (object) array(
			'status'  => 'recommended',
			'message' => __( 'Auto-updates for plugins appear to be disabled. This will prevent your site from receiving new versions automatically when available.' ),
		);
	} elseif ( ! $test_themes_enabled && $theme_filter_present ) {
		return (object) array(
			'status'  => 'recommended',
			'message' => __( 'Auto-updates for themes appear to be disabled. This will prevent your site from receiving new versions automatically when available.' ),
		);
	}

	return (object) array(
		'status'  => 'good',
		'message' => __( 'There appear to be no issues with plugin and theme auto-updates.' ),
	);
}