0

In the V1 of the Wordpress JSON API when you got a list of posts you would also get details of the author, tags and categories.

But in V2 it seems you just get the ID and would need to do another request to get more info.

Is there a way around this, such as a query parameter to automatically expand certain things?

Here is what V1 would return:

tags: {
    FM: {
        ID: 153647,
        name: "FM",
        slug: "fm",
        description: "",
        post_count: 68,
    },
    FM17: {
        ID: 130762795,
        name: "FM17",
        slug: "fm17",
        description: "",
        post_count: 31,
    }
}

Here is what V2 returns:

tags: {
    153647,
    130762795
}   

At the moment it's not clear if there is any benefit to using V1 over V2 of the api, V1 would infact be easier in this instance.

0

I figured this out, you have to add _embed=1 to any request so:

/posts?_embed=1&orderby=date&order=asc

for instance.

Then it will include an _embeddable key. Annoyingly all the terms come under here so you have to do some extra work to extract the difference between tags and categories etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.