Create category with custom fields (json)
-
I’m trying to create a category with custom fields, the category is created successfully but the custom fields are not being setted.
I’m using
/wp-json/wp/v2/categories
endpoint with POST method,Content-Type: application/json
, the body is:{"description":"test description","link":"https://domain/category/test/","name":"Test","slug":"test","parent":0,"meta":[],"fields":{"image":108}}
The response is:
{"id":15,"count":0,"description":"","link":"http:\/\/domain\/category\/Test\/","name":"Test","slug":"Test","taxonomy":"category","parent":0,"meta":[],"acf":[],"_links":{"self":[{"href":"http:\/\/domain\/wp-json\/wp\/v2\/categories\/15"}],"collection":[{"href":"http:\/\/domain\/wp-json\/wp\/v2\/categories"}],"about":[{"href":"http:\/\/domain\/wp-json\/wp\/v2\/taxonomies\/category"}],"wp:post_type":[{"href":"http:\/\/domain\/wp-json\/wp\/v2\/posts?categories=15"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
The “acf” field is empty, can anyone provide me an example about how to make the call?
Thanks!
- The topic ‘Create category with custom fields (json)’ is closed to new replies.