Unlock Hidden Powers: Transform Your WordPress Workflow with WP-CLI Today!

Unlock Hidden Powers: Transform Your WordPress Workflow with WP-CLI Today!

Again, the post IDs are used when specifying which post(s) to delete:

wp post delete 649
WP-CLI-wp-post-update-list

To delete multiple posts, separate the IDs with a space:

wp post delete 649 300 150

By default, posts are moved to the trash. However, you can use the –force flag to skip the trash folder and delete the post:

wp post delete 648 --force

If you want to delete all pages, you can use the following command:

wp post delete $(wp post list --post_type=page --format=ids)
WP-CLI-wp-post-delete

This command deletes all posts by a specific user:

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38