wp_ajax_health_check_dotorg_communication

函数
wp_ajax_health_check_dotorg_communication ( No parameters )

wp_ajax_health_check_dotorg_communication: 这个函数是一个WordPress的AJAX处理程序,用来检查网站是否能与WordPress.org的API通信。它不需要任何参数,并返回一个表明通信状态的JSON响应。

服务器通信时网站健康检查的Ajax处理程序。

function wp_ajax_health_check_dotorg_communication() {
	_doing_it_wrong(
		'wp_ajax_health_check_dotorg_communication',
		sprintf(
		// translators: 1: The Site Health action that is no longer used by core. 2: The new function that replaces it.
			__( 'The Site Health check for %1$s has been replaced with %2$s.' ),
			'wp_ajax_health_check_dotorg_communication',
			'WP_REST_Site_Health_Controller::test_dotorg_communication'
		),
		'5.6.0'
	);

	check_ajax_referer( 'health-check-site-status' );

	if ( ! current_user_can( 'view_site_health_checks' ) ) {
		wp_send_json_error();
	}

	if ( ! class_exists( 'WP_Site_Health' ) ) {
		require_once ABSPATH . 'wp-admin/includes/class-wp-site-health.php';
	}

	$site_health = WP_Site_Health::get_instance();
	wp_send_json_success( $site_health->get_test_dotorg_communication() );
}

常见问题

FAQs
查看更多 >