Quantcast
Channel: Question and Answer » json
Viewing all articles
Browse latest Browse all 148

Why aren't tags and categories added in post request to WP Rest API

$
0
0

I’m using V2.0 and trying to create a post using the /posts endpoint.

Here’s the payload being sent with my request:

var payload =
   {
     title : "some title",
     format : "link",
     tags: ["tag1", "tag2"],
     categories: ["newsletter"],
     content: "http://someurl.com",
     status: "publish"
   };

The posts are successfully being created and all other fields are added except for the category and tags.

I see that both of them are supposed to take an array of strings. What am I missing here?

Also, I’ve tried adding both categories and tags that already exist on the site, and brand new ones. both don’t work.


Viewing all articles
Browse latest Browse all 148

Trending Articles