This WP CLI posts generator, unlike the core generator in WP CLI, supports the following:
NEW - using wp jw-random cleanup <options>
this script now cleans up after itself.
Thanks to @fzaninotto for the Faker library.
Currently this CLI command does not support meta-data, mainly due to the amount of commands you would need to run for large sites. Still a great script if you need to generate some placeholder posts fast, especially with featured images and terms.
Installing the random post generator is SUPER easy, for the latest and greatest, do the following:
wp package install jaywood/jw-wpcli-random-posts:dev-master
If you'd like a specific version, say 2.0, it's this simple:
wp package install jaywood/jw-wpcli-random-posts:2.0
Possibly the simplest way to use the generator.
wp jw-random generate 50
First find the author you want to attach the Post to
wp user list
Now you know the author ID just use the --author
flag like so:
wp jw-random generate 10 --author=13 --featured-image
The author field also supports slug ( login ), and email.
( --term-count
tells the script to also add 15 terms to each taxonomy )
wp jw-random generate 10 --featured-image --taxonomies=category,post_tag --term-count=15
( --force-delete
permanently deletes posts and media instead of just trashing them )
wp jw-random cleanup --tax=post_tag,category --force-delete
In the interest of keeping this readme slim, all options have been moved to the Wiki.
--site
option, use --url
instead.md5_file()
to prevent image duplication within the media library.posts
command to generate
- makes more sense.--n
for specfying post count, make post count required positional argument instead.post_type_exists
checks on multisite installs.post_status
flag for generating posts, you can now set your own status.Initial Release