You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have at least two places where the rest initialization happens (add_action( 'rest_api_init', ... );).
To avoid unnecessary runtime operations, the initialization can be conditional - can be a wrapping if-statement around adding the hook or inside the invoked methods.
Note: the conditional ideas are
relying to WC()->is_rest_api_request()
match the rest URL to include @^/wc/v3/payments/.+@, that'll guard our rest APIs from loading in the wrong context.
relying to get_current_screen()
relying to doing_action( 'woocommerce_admin_shared_settings' )
Acceptance criteria
We evaluate that there is no higher-level logic which does it already
CI checks pass after any implemented changes
Additional context
The side-quest discovery of p1715098461138369-slack-CGGCLBN58
Ideally, we don't need such checks, but from the linked context, we have this code fragment and want to explore if we can skip this context for loading our rest
The text was updated successfully, but these errors were encountered:
Description
We have at least two places where the rest initialization happens (
add_action( 'rest_api_init', ... );
).To avoid unnecessary runtime operations, the initialization can be conditional - can be a wrapping if-statement around adding the hook or inside the invoked methods.
Note: the conditional ideas are
relying toWC()->is_rest_api_request()
match the rest URL to include@^/wc/v3/payments/.+@
, that'll guard our rest APIs from loading in the wrong context.get_current_screen()
doing_action( 'woocommerce_admin_shared_settings' )
Acceptance criteria
Additional context
The text was updated successfully, but these errors were encountered: