Automattic\WooCommerce\Internal\Utilities
FilesystemUtil::get_wp_filesystem
Wrapper to retrieve the class instance contained in the $wp_filesystem global, after initializing if necessary.
Method of the class: FilesystemUtil{}
No Hooks.
Returns
WP_Filesystem_Base.
Usage
$result = FilesystemUtil::get_wp_filesystem(): WP_Filesystem_Base;
FilesystemUtil::get_wp_filesystem() FilesystemUtil::get wp filesystem code WC 10.3.3
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;
}