woocommerce_graphql_can_introspect filter-hookWC 10.9.0

Filters whether the current principal may run GraphQL introspection.

The filter receives the principal-derived decision (false when the principal doesn't declare can_introspect() or its can_introspect() doesn't return strictly true) and must return strictly true to grant access; any other return value denies. The filter is not invoked when principal resolution failed (i.e. when the controller passes a null principal) — that case denies outright.

Usage

add_filter( 'woocommerce_graphql_can_introspect', 'wp_kama_woocommerce_graphql_can_introspect_filter', 10, 3 );

/**
 * Function for `woocommerce_graphql_can_introspect` filter-hook.
 * 
 * @param bool             $can_introspect Whether the principal can introspect, derived from `$principal->can_introspect()`.
 * @param object           $principal      The resolved principal.
 * @param \WP_REST_Request $request        The REST request being processed.
 *
 * @return bool
 */
function wp_kama_woocommerce_graphql_can_introspect_filter( $can_introspect, $principal, $request ){

	// filter...
	return $can_introspect;
}
$can_introspect(true|false)
Whether the principal can introspect, derived from $principal->can_introspect().
$principal(object)
The resolved principal.
$request(\WP_REST_Request)
The REST request being processed.

Changelog

Since 10.9.0 Introduced.

Where the hook is called

GraphQLControllerBase::is_introspection_allowed()
woocommerce_graphql_can_introspect
woocommerce/src/Api/Infrastructure/GraphQLControllerBase.php 766
$can_introspect = apply_filters( 'woocommerce_graphql_can_introspect', $can_introspect, $principal, $request );

Where the hook is used in WooCommerce

Usage not found.