Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
update_meta_value example
$is_valid
=
rest_validate_value_from_schema
(
$value
,
$args
[
'schema'
]
, 'meta.' .
$name
)
;
if
(
is_wp_error
(
$is_valid
)
)
{
$is_valid
->
add_data
(
array
(
'status' => 400
)
)
;
return
$is_valid
;
}
$value
=
rest_sanitize_value_from_schema
(
$value
,
$args
[
'schema'
]
)
;
if
(
$args
[
'single'
]
)
{
$result
=
$this
->
update_meta_value
(
$object_id
,
$meta_key
,
$name
,
$value
)
;
}
else
{
$result
=
$this
->
update_multi_meta_value
(
$object_id
,
$meta_key
,
$name
,
$value
)
;
}
if
(
is_wp_error
(
$result
)
)
{
return
$result
;
}
}
return
null;
}