Answer the question
In order to leave comments, you need to log in
How to delete all media at once in wordpress?
There are more than 350k media on the site, we removed them from the uploads folder, but they remained in the wodrpress control panel. How to remove them all at once?
Answer the question
In order to leave comments, you need to log in
DELETE FROM `wp_posts` WHERE `post_type` = "attachment";
DELETE FROM `wp_postmeta` WHERE `meta_key` = "_wp_attached_file";
DELETE FROM `wp_postmeta` WHERE `meta_key` = "_wp_attachment_metadata";
These 3 queries against the database will remove all master media records, unless they created some custom fields for the images.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question