That's a lot of work, deleting hundreds of thousands of huge post data.
Let's use the WP-CLI command to delete all those data at once.
How to use
Bulk delete all post data.
wp post delete $(wp post list --post_type='post' --format=ids) --force
If you want to delete data from your custom post type, you can specify the post type in the
# Delete post type 'news' wp post delete $(wp post list --post_type='news' --format=ids) --force
If you have too much data to delete, you may get an
Argument list too long error.
In that case, you can delete it little by little with a shell script like the following.
#!/bin/sh # Deleting 10,000 at a time. for i in `seq 1 10` do wp post delete $(wp post list --post_type='your-post-type' --format=ids --posts_per_page=10000) --force done echo "done"
Top comments (0)