Automattic\WooCommerce\Api\Infrastructure
Main::register
Register the GraphQL endpoint when the feature is active.
When the feature is off this is a no-op. Classes in the public Automattic\WooCommerce\Api\ namespace remain autoloadable — extensions that want to know whether the feature is active should check FeaturesUtil::feature_is_enabled( 'dual_code_graphql_api' ) rather than class_exists() on the Api namespace.
The feature-enabled check is deferred to the rest_api_init to avoid triggering translation loading (via FeaturesController) before the init action has fired, which would cause a _load_textdomain_just_in_time notice on WordPress 6.7+.
Метод класса: Main{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$result = Main::register(): void;
Код Main::register() Main::register WC 11.0.1
public static function register(): void {
add_action( 'rest_api_init', array( self::class, 'handle_rest_api_init_for_core' ) );
$settings = wc_get_container()->get( Settings::class );
$settings->register();
add_action( OpcacheFileExpiry::ACTION_HOOK, array( OpcacheFileExpiry::class, 'handle_cleanup_action' ) );
}