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

WC_Admin_Notices::is_uploads_directory_protected() protected WC 4.2.0

Check if uploads directory is protected.

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

Хуков нет.

Возвращает

true/false.

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

$result = WC_Admin_Notices::is_uploads_directory_protected();

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

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

Код WC_Admin_Notices::is_uploads_directory_protected() WC 4.5.2

woocommerce/includes/admin/class-wc-admin-notices.php
<?php
protected static function is_uploads_directory_protected() {
	$cache_key = '_woocommerce_upload_directory_status';
	$status    = get_transient( $cache_key );

	// Check for cache.
	if ( false !== $status ) {
		return 'protected' === $status;
	}

	// Get only data from the uploads directory.
	$uploads = wp_get_upload_dir();

	// Check for the "uploads/woocommerce_uploads" directory.
	$response         = wp_safe_remote_get(
		esc_url_raw( $uploads['baseurl'] . '/woocommerce_uploads/' ),
		array(
			'redirection' => 0,
		)
	);
	$response_code    = intval( wp_remote_retrieve_response_code( $response ) );
	$response_content = wp_remote_retrieve_body( $response );

	// Check if returns 200 with empty content in case can open an index.html file,
	// and check for non-200 codes in case the directory is protected.
	$is_protected = ( 200 === $response_code && empty( $response_content ) ) || ( 200 !== $response_code );
	set_transient( $cache_key, $is_protected ? 'protected' : 'unprotected', 1 * DAY_IN_SECONDS );

	return $is_protected;
}