I want to update half of all posts with status from published
to trashed
.
Example:
- if I have 10000 posts, 5000 post to trash
- If I have 6000 posts, 3000 posts to trash
- If I have 7000 posts, 3500 posts to trash
I want to update half of all posts with status from published
to trashed
.
Example:
Comments are closed.
Assuming you want to delete by date, here is a basic concept. You’d need to figure out when you want this to run, otherwise, as I commented above, you’ll end up with only 1 post if it runs repeatedly.
Edit: Including parameter for a bit of safety
Must stress that this is a very dangerous function. If you attempt it, please back up your database. And you’ll need to pass an integer to it that represents a total post count size that is too large for your liking, which will then allow the thinning.