1

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?

enter image description here

1

They 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 = ''
| improve this answer | |
  • Brilliant. Thank you very much!!! – stemon May 7 '19 at 17:44
  • If this answered your question, please do mark it as the official answer so others searching will see it was successful. :) – WebElaine May 7 '19 at 18:04
  • Sure. I tried to vote it but can't due to my low reputation score. Anything else I can do? – stemon May 8 '19 at 17:46
  • Underneath the voting up/down arrows there is a checkmark - click on that and it accepts the answer. – WebElaine May 8 '19 at 18:25
  • Done. Thanks!!! – stemon May 8 '19 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.