Automattic\WooCommerce\Admin\Features

Features::should_load_features()private staticWC 1.0

Check if we're in an admin context where features should be loaded.

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

Хуки из метода

Возвращает

true|false.

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

$result = Features::should_load_features();

Код Features::should_load_features() WC 9.7.1

private static function should_load_features() {
	$should_load = (
		is_admin() ||
		wp_doing_ajax() ||
		wp_doing_cron() ||
		( defined( 'WP_CLI' ) && WP_CLI ) ||
		( WC()->is_rest_api_request() && ! WC()->is_store_api_request() ) ||
		// Allow features to be loaded in frontend for admin users. This is needed for the use case such as the coming soon footer banner.
		current_user_can( 'manage_woocommerce' )
	);

	/**
	 * Filter to determine if admin features should be loaded.
	 *
	 * @since 9.6.0
	 * @param boolean $should_load Whether admin features should be loaded. It defaults to true when the current request is in an admin context.
	 */
	return apply_filters( 'woocommerce_admin_should_load_features', $should_load );
}