WP_Site_Health::get_test_loopback_requests() WordPress Method

The WP_Site_Health::get_test_loopback_requests() method is used to test whether loopback requests are working correctly on a WordPress site. Loopback requests are used to communicate with the WordPress site itself, and are necessary for many features to work correctly. This test will check to see if loopback requests are working by making a request to the WordPress site and checking the response.

WP_Site_Health::get_test_loopback_requests() #

Test if loopbacks work as expected.


Description

A loopback is when WordPress queries itself, for example to start a new WP_Cron instance, or when editing a plugin or theme. This has shown itself to be a recurring issue, as code can very easily break this interaction.


Top ↑

Return

(array) The test results.


Top ↑

Source

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

	public function get_test_loopback_requests() {
		$result = array(
			'label'       => __( 'Your site can perform loopback requests' ),
			'status'      => 'good',
			'badge'       => array(
				'label' => __( 'Performance' ),
				'color' => 'blue',
			),
			'description' => sprintf(
				'<p>%s</p>',
				__( 'Loopback requests are used to run scheduled events, and are also used by the built-in editors for themes and plugins to verify code stability.' )
			),
			'actions'     => '',
			'test'        => 'loopback_requests',
		);

		$check_loopback = $this->can_perform_loopback();

		$result['status'] = $check_loopback->status;

		if ( 'good' !== $result['status'] ) {
			$result['label'] = __( 'Your site could not complete a loopback request' );

			$result['description'] .= sprintf(
				'<p>%s</p>',
				$check_loopback->message
			);
		}

		return $result;
	}


Top ↑

Changelog

Changelog
VersionDescription
5.2.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.