I'm attempting to modify the WooCommerce REST API response with the woocommerce_rest_prepare_shop_order_object filter.

I've got this working as intended. The only thing left is that I need to make it so that the contents of this function only apply to requests made with one specific API key.

In other words, the REST API response should remain completely unchanged for every API user/key except for one specific one. Responses to requests using the specific key only should be modified by my function.

I've Googled around quite a bit and haven't found what I'm looking for. Is there an easy way to check the user / API key against an arbitrary value, so that if they don't match then the response goes unmodified?

Thank you in advance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.