date |
(iso 8601 datetime) |
The post's creation time. |
title |
(html) |
The post title. |
content |
(html) |
The post content. |
excerpt |
(html) |
An optional post excerpt. |
slug |
(string) |
The name (slug) for the post, used in URLs. |
author |
(string) |
The username or ID for the user to assign the post to. |
publicize |
(array|bool) |
True or false if the post be shared to external services. An array of services if we only want to share to a select few. Defaults to true. |
publicize_message |
(string) |
Custom message to be shared to external services. |
status |
(string) |
- publish:
- (default) Publish the post.
- private:
- Privately publish the post.
- draft:
- Save the post as a draft.
- pending:
- Mark the post as pending editorial approval.
- future:
- Schedule the post (alias for publish; you must also set a future date).
- auto-draft:
- Save a placeholder for a newly created post, with no content.
|
sticky |
(bool) |
- false:
- (default) Post is not marked as sticky.
- true:
- Stick the post to the front page.
|
password |
(string) |
The plaintext password protecting the post, or, more likely, the empty string if the post is not password protected. |
parent |
(int) |
The post ID of the new post's parent. |
type |
(string) |
The post type. Defaults to 'post'. Post types besides post and page need to be whitelisted using the rest_api_allowed_post_types filter. |
terms |
(object) |
Mapping of taxonomy to comma-separated list or array of term names |
categories |
(array|string) |
Comma-separated list or array of category names |
tags |
(array|string) |
Comma-separated list or array of tag names |
terms_by_id |
(object) |
Mapping of taxonomy to comma-separated list or array of term IDs |
categories_by_id |
(array|string) |
Comma-separated list or array of category IDs |
tags_by_id |
(array|string) |
Comma-separated list or array of tag IDs |
format |
(string) |
- default:
- (default) Use default post format
- standard:
- Standard
- aside:
- Aside
- chat:
- Chat
- gallery:
- Gallery
- link:
- Link
- image:
- Image
- quote:
- Quote
- status:
- Status
- video:
- Video
- audio:
- Audio
|
featured_image |
(string) |
The post ID of an existing attachment to set as the featured image. Pass an empty string to delete the existing image. |
media |
(media) |
An array of files to attach to the post. To upload media, the entire request should be multipart/form-data encoded. Multiple media items will be displayed in a gallery. Accepts jpg, jpeg, png, gif, pdf, doc, ppt, odt, pptx, docx, pps, ppsx, xls, xlsx, key. Audio and Video may also be available. See allowed_file_types in the options response of the site endpoint. Errors produced by media uploads, if any, will be in `media_errors` in the response.
Example:
curl \ --form 'title=Image Post' \ --form 'media[0]=@/path/to/file.jpg' \ --form 'media_attrs[0][caption]=My Great Photo' \ -H 'Authorization: BEARER your-token' \ 'https://public-api.wordpress.com/rest/v1/sites/123/posts/new' |
media_urls |
(array) |
An array of URLs for images to attach to a post. Sideloads the media in for a post. Errors produced by media sideloading, if any, will be in `media_errors` in the response. |
media_attrs |
(array) |
An array of attributes (`title`, `description` and `caption`) are supported to assign to the media uploaded via the `media` or `media_urls` properties. You must use a numeric index for the keys of `media_attrs` which follow the same sequence as `media` and `media_urls`.
Example:
curl \ --form 'title=Gallery Post' \ --form 'media[]=@/path/to/file1.jpg' \ --form 'media_urls[]=http://exapmple.com/file2.jpg' \ \ --form 'media_attrs[0][caption]=This will be the caption for file1.jpg' \ --form 'media_attrs[1][title]=This will be the title for file2.jpg' \ -H 'Authorization: BEARER your-token' \ 'https://public-api.wordpress.com/rest/v1/sites/123/posts/new' |
metadata |
(array) |
Array of metadata objects containing the following properties: `key` (metadata key), `id` (meta ID), `previous_value` (if set, the action will only occur for the provided previous value), `value` (the new value to set the meta to), `operation` (the operation to perform: `update` or `add`; defaults to `update`). All unprotected meta keys are available by default for read requests. Both unprotected and protected meta keys are avaiable for authenticated requests with proper capabilities. Protected meta keys can be made available with the rest_api_allowed_public_metadata filter. |
discussion |
(object) |
A hash containing one or more of the following boolean values, which default to the blog's discussion preferences: `comments_open`, `pings_open` |
likes_enabled |
(bool) |
Should the post be open to likes? Defaults to the blog's preference. |
sharing_enabled |
(bool) |
Should sharing buttons show on this post? Defaults to true. |
menu_order |
(int) |
(Pages Only) the order pages should appear in. Use 0 to maintain alphabetical order. |
page_template |
(string) |
(Pages Only) The page template this page should use. |