WordPress at Your Fingertips
function is not described

WP_Site_Health_Auto_Updates::test_check_wp_filesystem_method() public WP 5.2.0

Check if we can access files without providing credentials.

{} It's a method of the class: WP_Site_Health_Auto_Updates{}

No Hooks.

Return

Array. The test results.

Usage

$WP_Site_Health_Auto_Updates = new WP_Site_Health_Auto_Updates();
$WP_Site_Health_Auto_Updates->test_check_wp_filesystem_method();

Changelog

Since 5.2.0 Introduced.

Code of WP_Site_Health_Auto_Updates::test_check_wp_filesystem_method() WP 5.8.2

function test_check_wp_filesystem_method() {
	// Make sure the `request_filesystem_credentials()` function is available during our REST API call.
	if ( ! function_exists( 'request_filesystem_credentials' ) ) {
		require_once ABSPATH . '/wp-admin/includes/file.php';
	}

	$skin    = new Automatic_Upgrader_Skin;
	$success = $skin->request_filesystem_credentials( false, ABSPATH );

	if ( ! $success ) {
		$description  = __( 'Your installation of WordPress prompts for FTP credentials to perform updates.' );
		$description .= ' ' . __( '(Your site is performing updates over FTP due to file ownership. Talk to your hosting company.)' );

		return array(
			'description' => $description,
			'severity'    => 'fail',
		);
	}

	return array(
		'description' => __( "Your installation of WordPress doesn't require FTP credentials to perform updates." ),
		'severity'    => 'pass',
	);
}