33 thoughts on “Custom post type and metadata support in the REST API

  1. Reblogged this on Joey Kudish and commented:

    An internal tool that I’m building at Automattic is using the WordPress.com REST API. As part of that tool, I needed access to custom post types and post metadata, so I’ve added both to our REST API. And now anyone on a Jetpack-powered site can also use this part of the REST API. Find out the details in this developer blog post.

  2. I hope that you will add support for Custom post types for Publicize, Photon and other modules… JetPack is huge help, but for CMS use of WP not so much… Enchanted support for Custom post types in JetPack would be dream come true for me and many other developers / users. .

  3. I really like these latest enhancements 🙂

    One major thing I’d really like to see though, as a plugin developer super eager to start doing some cool things here:

    meta_query / tax_query support in get posts (single site / multiple sites)

    Please keep that in mind for the future, so much that we can do once we’ve got that, would save a lot of manual iteration through PHP arrays to filter down.

    1. I agree it would be cool to see meta_query / tax_query in the API. No plans for it as of now as far as I know, though we do support basic meta_key, meta_value and tags and categories queries.

  4. Also, it wasn’t immediate apparent, but in the get post data, does it return data unserialized or do serialized arrays remain serialized?

    And in add/update post data, assuming it accepts arrays/objects and will serialize accordingly?

    1. An array/object should be returned as a json array or object. And yes the API should accept arrays and objects. If you have any trouble with it, please let us know!

  5. Is there a filter to add meta keys to a blacklist? Say you have meta that is intended to be edited only by users with ‘unfiltered_html’ capabilities, not ‘edit_meta_data’. Anyway to disable or modify the api exposure?

    1. Hi Ken,

      Sorry for the delayed response. At this time, it’s not possible to blacklist an API key. Can you please share a bit more details about what you’re doing and we might be able to help out better?

      1. I see now that the edit_meta_data capability isn’t assigned to any users unless explicitly assigned to the key. I misunderstood its implementation. I was worried that a key would be exposed unintentionally. Thanks!

  6. Hi I tried to access my api unauthenticated and all I got in the metadata array is [false], according to this article, I can access my post metadata without authentication, any idea? Thanks!

    1. Unfortunately at this time the REST API doesn’t support custom taxonomies. We have plans to add support at some time in the future but nothing to announce as of now.

  7. Nice article!
    Was looking for jetpack json api request, response structure for android app at hackpundit.com.
    Also wanted custom fields to be shown in json for lightweight response. Description was not required

Comments are closed.