update_cpt
This endpoint will allow you to update custom post type CPT posts by providing type var. Featured image can also be attached with the post.
Custom fields can be added via `update_post_meta` endpoint using post_id.
`nonce` requirement can be disabled from Settings > UserPlus. Admin notification for any new submitted posts can also be enabled/disabled from Settings > UserPlus.
Note: User must have capability to update post. Change user role if needed. Only author of post or admin can update it.
Update post with featured image screenshot:
Update Post screenshot:
Attach custom taxonomy to the post screenshot:
Resource URL
http://localhost/api/userplus/update_post/
Method
POST
Required Parameters
- cookie - for user authentication
- post_id – post ID to be updated
- nonce - available from the get_nonce method (call with vars controller=userplus and method=update_post)
- key – get API key from Settings > User Plus
Optional Parameters
- type – Post Type. Default is `post`.
- status - sets the post status ("draft" or "publish")
- title - the post title
- content - the post content
- categories - a comma-separated list of categories (URL slugs)
- tags - a comma-separated list of tags (URL slugs)
- post_media – to delete all previously attached images from post, pass value ‘delete’
- attachment – upload field will cause an attachment to be stored with new post with image set as featured thumbnail. Previously uploaded images will still be attached to post. Old media can be deleted by sending post_media=delete
- post_meta - associative array of meta_key and meta_value
- taxonomy - Array keys of custom taxonomy type like this taxonomy[taxonomy_type] = comma separated ids of taxonomy, check screenshot
- taxonomy_append = true. To append values of existing taxonomies
- post_parent - you can set post parent, only works for page type post
- post_image - you can use this to attach multiple images of file type as array
- post_name - you can update post slug
Sample Request URL
http://localhost/api/userplus/update_cpt/