This endpoint will allow you to update posts. You can also add CPT 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:
- 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
- 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_name - you can update post slug
Sample Request URL
Trying to use the update_post method but keep receiving “Post not found. wrong post_id provided.” as result. Can someone please help?
If you are trying to update Custom Post Type (CPT), then you use update_cpt endpoint. Otherwise, if the post_id or slug is correct, it will work.