Wordpress Rest API - Custom Fields

admin

Administrator
Staff member
I have created a custom post type in Wordpress and exposed it to rest API. I have also added custom fields to this post using the ACF plugin.

In my themes function.php I have registered these fields in the response and I can see them when I make a get request.

Code:
register_rest_field('auto', 'specs', array('get_callback' => 'get_autos_specs_for_api'));

The problem is that when I send a post request, wordpress doesn't recognize these fields. It creates a new post with the title and all the extra fields are empty.