WP CLI说明文档

命令概述

用于管理 WordPress 文章内容,支持创建、更新、删除、查询及批量处理文章与页面。

适合在需要自动化管理文章、页面或自定义文章类型时使用。

参数列表

参数 说明
--post_type 文章类型,如 post、page 或自定义类型。
--post_title 文章标题。
--post_status 文章状态,如 publish、draft 等。

常用示例

创建新文章

$ wp post create --post_type=post --post_title='A sample post'

更新现有文章

$ wp post update 123 --post_status=draft

删除文章

$ wp post delete 123