woocommerce_graphql_can_use_debug_mode filter-hookWC 10.9.0

Filters whether the current principal may activate GraphQL debug mode.

Only invoked when the request carries _debug=1 and a principal was resolved successfully, so the filter is not called on every GraphQL request. The filter receives the principal-derived decision (false when the principal doesn't declare can_use_debug_mode() or its can_use_debug_mode() doesn't return strictly true) and must return strictly true to grant access; any other return value denies.

Usage

add_filter( 'woocommerce_graphql_can_use_debug_mode', 'wp_kama_woocommerce_graphql_can_use_debug_mode_filter', 10, 3 );

/**
 * Function for `woocommerce_graphql_can_use_debug_mode` filter-hook.
 * 
 * @param bool             $can_debug Whether the principal can use debug mode, derived from `$principal->can_use_debug_mode()`.
 * @param object           $principal The resolved principal.
 * @param \WP_REST_Request $request   The REST request being processed.
 *
 * @return bool
 */
function wp_kama_woocommerce_graphql_can_use_debug_mode_filter( $can_debug, $principal, $request ){

	// filter...
	return $can_debug;
}
$can_debug(true|false)
Whether the principal can use debug mode, derived from $principal->can_use_debug_mode().
$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_debug_mode()
woocommerce_graphql_can_use_debug_mode
woocommerce/src/Api/Infrastructure/GraphQLControllerBase.php 822
$can_debug = apply_filters( 'woocommerce_graphql_can_use_debug_mode', $can_debug, $principal, $request );

Where the hook is used in WooCommerce

Usage not found.