Im setting up an endpoint that I want to use to update ACF fields in a custom post type.
Here I register the field endpoint and callback
function wp_api_assign_external_writer() {
register_rest_route( 'responsify/v1', 'assign_external_writer/', array(
'methods' => 'POST',
'callback' => 'assign_external_writer_callback',
));
}
function assign_external_writer_callback( $request ) {
$parameters = $request->get_params();
$project_id = $parameters['project_id'];
$writer = $parameters['writer'];
update_field('content_external_writer',$writer,$project_id);
}
sending this request in postman: http://localhost:32851/wp-json/responsify/v1/assign_external_writer?writer=32272&project=2527
If I use "title=my_new_title" instead of writer it updates correctly. But using an ACF doesnt update. I read that this should work with update_field but it is not. Am I doing something wrong?