wordpress-api-client
wordpress-api-client copied to clipboard
Why is this package stripping content out of the request body?
I threw some console.logs into your fetch package after tearing my hair out over acf fields not making it through the request.
Code:
api.customType().create({
title: { raw },
content: { raw },
acf: { field1, field2 },
foo: 'bar',
});
Actual fetch:
{
url: 'wp/v2/customType',
body: '{ "title":"...", "content":"...", "foo":"bar" }',
method: 'post'
}
What could be the reason for this?
https://github.com/dkress59/wordpress-api-client/blob/55887526a7c0965b134608e37ce00406065a755a/src/util.ts#L98
Additionally, it was difficult to figure out what the create() JSON format was supposed to look like (not title:"" but title:{raw}), as there are no full examples in the docs.