生成指定数量的虚拟文章,用于测试或填充内容。
适合在开发或测试环境中快速创建大量示例文章。
| 参数 | 说明 |
|---|---|
--count= |
要生成的文章数量。默认:100 |
--post_type= |
生成的文章类型。默认:post |
--post_status= |
生成的文章状态。默认:publish |
--post_title= |
文章标题。默认值:无 |
--post_author= |
生成的文章作者。默认值:无 |
--post_date= |
文章的日期。默认为当前时间。 |
--post_date_gmt= |
文章在GMT时区的日期。默认为 –post_date 的值。 |
--post_content |
如果设置,命令从STDIN读取文章内容。 |
--max_depth= |
对于层级文章类型,生成子文章到指定深度。默认:1 |
--format= |
以特定格式输出。默认:progress;选项:progress、ids |
$ wp post generate --count=10 --post_type=page --post_date=1999-01-04
$ curl -N https://loripsum.net/api/5 | wp post generate --post_content --count=10
$ wp post generate --format=ids | xargs -d ' ' -I % wp post meta add % foo bar