0
votes

I have a website that operates similarly to many freelancing websites where people can make bids. Its become painfully slow in recent weeks and I used query monitor to find out the issue is likely over 140,000 posts that were build up over the last 5 years. Below is a query that takes 36 seconds (from query monitor) ...

SELECT wp_4_posts.ID
FROM wp_4_posts
WHERE 1=1
AND wp_4_posts.post_parent = 427941
AND wp_4_posts.post_author IN (1)
AND wp_4_posts.post_type = 'bid'
AND ((wp_4_posts.post_status = 'publish'))
ORDER BY wp_4_posts.post_date DESC
LIMIT 0, 5  +
WP_Query->get_posts()

...

I'm wondering how I can:

  1. Delete any post of type "bid" that are in draft status
  2. Delete any post of type "bid" that are in published status but made before 2020
1
Presumably you have a composite index on some permutation of (post_parent,post_author,post_type,post_status,post_date)? - Strawberry

1 Answers

0
votes

The best solution for your is Bulk delete plugin, this plugin will allow you to delete a specific post type, specific post status, and you can do the operation in a bundle, like 50 posts at a time, or 200.

https://wordpress.org/plugins/wp-bulk-delete/

enter image description here