Fix check, because `json_ensure_response` doesn't handle `WP_Error`