@d0153 I personally use this snipped as part of a custom REST API endpoint, e.g.:
add_action('rest_api_init', function () {
register_rest_route(
'test/v1',
'/events/',
array(
'methods' => 'POST',
'callback' => 'test_create_event',
)
);
});
I’ve encountered the same issue, thanks in advance for any updates!