Automattic\WooCommerce\Internal\Utilities

FilesystemUtil::get_wp_filesystem()public staticWC 1.0

Wrapper to retrieve the class instance contained in the $wp_filesystem global, after initializing if necessary.

Метод класса: FilesystemUtil{}

Хуков нет.

Возвращает

WP_Filesystem_Base.

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

$result = FilesystemUtil::get_wp_filesystem(): WP_Filesystem_Base;

Код FilesystemUtil::get_wp_filesystem() WC 9.7.1

public static function get_wp_filesystem(): WP_Filesystem_Base {
	global $wp_filesystem;

	if ( ! $wp_filesystem instanceof WP_Filesystem_Base ) {
		$initialized = self::initialize_wp_filesystem();

		if ( false === $initialized ) {
			throw new Exception( 'The WordPress filesystem could not be initialized.' );
		}
	}

	return $wp_filesystem;
}