Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
check_authentication example
$allow_headers
=
apply_filters
(
'rest_allowed_cors_headers',
$allow_headers
,
$request
)
;
$this
->
send_header
(
'Access-Control-Allow-Headers',
implode
(
', ',
$allow_headers
)
)
;
$result
=
$this
->
check_authentication
(
)
;
if
(
!
is_wp_error
(
$result
)
)
{
$result
=
$this
->
dispatch
(
$request
)
;
}
// Normalize to either WP_Error or WP_REST_Response...
$result
=
rest_ensure_response
(
$result
)
;
// ...then convert WP_Error across.
if
(
is_wp_error
(
$result
)
)
{
$result
=
$this
->
error_to_response
(
$result
)
;
}