Over 2000 empty posts were created and I cannot delete them from the admin. Couldn't find them on SQL either using
SELECT *
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON ( a.ID = b.object_id )
LEFT JOIN wp_postmeta c ON ( a.ID = c.post_id )
LEFT JOIN wp_term_taxonomy d ON ( d.term_taxonomy_id =
b.term_taxonomy_id )
LEFT JOIN wp_terms e ON ( e.term_id = d.term_id )
WHERE e.term_id = 1
Maybe they are _postmeta? How would you go to delete them?
Over 2000 empty posts were created and I cannot delete them from the admin. Couldn't find them on SQL either using
SELECT *
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON ( a.ID = b.object_id )
LEFT JOIN wp_postmeta c ON ( a.ID = c.post_id )
LEFT JOIN wp_term_taxonomy d ON ( d.term_taxonomy_id =
b.term_taxonomy_id )
LEFT JOIN wp_terms e ON ( e.term_id = d.term_id )
WHERE e.term_id = 1
Maybe they are _postmeta? How would you go to delete them?
Share Improve this question asked May 7, 2019 at 15:52 stemonstemon 1551 silver badge8 bronze badges 1- wordpress/plugins/bulk-delete – Castiblanco Commented May 7, 2019 at 17:08
1 Answer
Reset to default 2They are definitely some sort of post - postmeta alone doesn't show up in the post listing screens like this. The fastest way to delete them would be to go to Screen Options to show more of the posts at once (say 500 per page so it doesn't time out) and use bulk actions to delete 500 at a time.
However, if you'd like to do things directly in the database:
You can run
SELECT * from wp_posts WHERE post_title = ''
to select all the posts that have no title. Once you have that list, you can delete the postmeta like this (replace 1,2,3 with your list of IDs, and replace wp_ prefix with your prefix):
DELETE from wp_postmeta WHERE post_id IN (1,2,3)
And you can delete the post's taxonomy associations like this (again replace 1,2,3 with your list of IDs, and replace wp_ prefix with your prefix):
DELETE from wp_term_relationships WHERE object_id IN (1,2,3)
Then don't forget to delete the posts themselves:
DELETE from wp_posts WHERE post_title = ''