📅  最后修改于: 2022-03-11 14:58:06.509000             🧑  作者: Mango
add_action('rest_api_init', 'bs_rest_api_hooks');
function bs_rest_api_hooks() {
register_rest_field(
'post',
'mtags',
array(
'get_callback' => 'm_get_tags',
)
);
}
function m_get_tags($object, $field_name, $request) {
$tags = get_the_tags($object["id"]);
return $tags;
}