You can only read acf datas with this plugin.
Here is a simple solution for read write acf data:
add_action( 'rest_api_init', 'register_rest_acf_field' );
function register_rest_acf_field() {
register_rest_field( 'post_type', 'acf_field_name', [
'get_callback' => read_acf_field',
'update_callback' => update_acf_field',
'schema' => null,
] );
}
function read_acf_field( $object, $field_name, $request ) {
return get_field( $field_name, $object[ 'id' ] );
}
function update_acf_field( $value, $object, $field_name ) {
if ( ! $value || ! is_string( $value ) ) {
return;
}
return update_field( $field_name, strip_tags( $value ), $object->ID );
}
[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been damaged by the forum’s parser.]