最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

rest api - Setting default category on post update

programmeradmin1浏览0评论

I would have a question regarding update of the post.

We are using the Wordpress API to manage articles and everything around, categories, tags...We have a scenario where on creation of the post, so POST /wp/v2/posts endpoint, if no category is sent, default category is chosen for this post. This is what we want and it works perfectly.

But, then when we want to update the post, so POST /wp/v2/posts/<id>, we would like if no category is sent in body, that default one is chosen. At the moment this is not the case. Nothing is changed regarding categories in this case. If I explicitly set null for categories then we just have post without category.

Any idea how to set default category on post update?

发布评论

评论列表(0)

  1. 暂无评论