Return to Snippet

Revision: 63054
at April 4, 2013 20:14 by rickygri


Initial Code
# First:

DELETE FROM wp_postmeta
WHERE post_id IN
(
SELECT id
FROM wp_posts
WHERE post_type = 'attachment'
)
;

# Second:

DELETE FROM wp_posts WHERE post_type = 'attachment'

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

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

Initial Title
SQL query to delete all media and attachments in wordpress

Initial Tags
sql, wordpress

Initial Language
SQL