SQL query to delete all media and attachments in wordpress


/ Published in: SQL
Save to your folder(s)

Run these queries (phpMyAdmin will do) to delete all media in the library, and remove all post attachment affiliation


Copy this code and paste it in your HTML
  1. # FIRST:
  2.  
  3. DELETE FROM wp_postmeta
  4. WHERE post_id IN
  5. (
  6. SELECT id
  7. FROM wp_posts
  8. WHERE post_type = 'attachment'
  9. )
  10. ;
  11.  
  12. # SECOND:
  13.  
  14. DELETE FROM wp_posts WHERE post_type = 'attachment'

URL: http://wordpress.org/support/topic/delete-100000-images-from-media-library

Report this snippet


Comments


You need to login to view comments.