WP Rest API vs - how can I get author information from v2 - the author ID?

I'm building a front end using WP JSON, and I need (among other things) the name of the author of each post.

In V1, this was easy - here's a fragment of a typical post object from calling http://example.com/wp-json/posts/1:

    "ID": 1,
    "title": "Hello world!",
    "status": "publish",
    "type": "post",
    "author": {
        "ID": 1,
        "name": "admin",
        "slug": "admin",
        "URL": "",
        "avatar": "http:\/\/0.gravatar.com\/avatar\/c57c8945079831fa3c19caef02e44614&d=404&r=G",
        "meta": {
            "links": {
                "self": "http:\/\/example.com\/wp-json\/users\/1",
                "archives": "http:\/\/example.com\/wp-json\/users\/1\/posts"

But in V2, for author, all we get back is the ID (an integer). Passing this back to the API, we get a list of every article an author has written - but how can I get the author's information - their name, avatar, etc.?

PS: boy the V2 documentation is sparse...V1 was much better...


Append the query parameter _embed in your API URL

Embedding is triggered by setting the _embed query parameter on the request. This will then include embedded resources under the _embedded key adjacent to the _links key in JSON file... as showed in http://v2.wp-api.org/reference/links.html




Getting Author Name from JSON, and showing:


Getting Featured Image:




and Tags:


I think what you want is /wp-json/wp/v2/users/1

You should also find the direct url at _links > author > href

Need Your Help

Eclipse on Mac 10.8 - Installed 1.7.0 JRE / JDK, but Eclipse won't launch

java eclipse macos

Installed Java SE 1.7.0u10 from Oracle w/ their installer package