WP-CLI をインストール
sudo su -
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar --info
chmod +x wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp
wp --info
投稿一覧を表示
https://developer.wordpress.org/cli/commands/post/list/
wp post list --allow-root
1000 件テスト投稿
https://developer.wordpress.org/cli/commands/post/create/
for i in {1..1000}; do
dt=$(date '+%Y-%m-%d %H:00:00' --date "-$i day")
echo $dt
wp post create --allow-root --post_type=post \
--post_title="[$i]テスト投稿テスト投稿テスト投稿テスト投稿テスト投稿テスト投稿" \
--post_content="[$i]テスト本文テスト本文テスト本文テスト本文テスト本文テスト本文" \
--post_status=publish \
--post_date="$dt"
done
参考
https://developer.wordpress.org/cli/commands/
タグ: WordPress, WP-CLI