Custom post type and metadata support in the REST API

Developer Resources

We’ve recently made some updates to the REST API which is available here on WordPress.com and for any Jetpack-enabled site that has the REST API module activated. The API now has full read and write support for custom post types and post metadata.

You can specify a post’s post type when you create or edit it. If you’re fetching a single post, you will receive its post type in the response. Of course, you can also specify a post type when fetching a series of posts. In all cases the parameter to use or look out for is type.

You can also query posts by metadata using the new meta_key and meta_value parameters. You can add, update, delete or retrieve a post’s metadata when creating, editing or getting a single post, using the new metadata parameter which accepts an array of metadata keys, ids, previous_value

View original post 324 more words

This entry was posted in Uncategorized. Bookmark the permalink.
  • Recent Comments

    Michael Avery on Jetpack 4.6: Google Analytics…
    Jakob Boman on Jetpack 4.6: Google Analytics…
    Jeremy on Jetpack 4.6: Google Analytics…
    Jeremy on Jetpack 4.6: Google Analytics…
    Girolamo Aloe on Jetpack 4.6: Google Analytics…
  • Archives

  • Enter your email address to follow this blog and receive notifications of new posts by email.

  • Relied on by millions of WordPress professionals worldwide.

    Install Free   See Pricing

    Created by Automattic: bringing the power of WordPress.com to every WordPress site.

    %d bloggers like this: