Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in /www/wwwroot/dev.zhalaotie.com/wp-includes/wp-db.php on line 3215

Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in /www/wwwroot/dev.zhalaotie.com/wp-includes/wp-db.php on line 3215
Wordpress How do I delete thousands of unattached images? – 扎老铁
Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in /www/wwwroot/dev.zhalaotie.com/wp-includes/wp-db.php on line 3215

Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in /www/wwwroot/dev.zhalaotie.com/wp-includes/wp-db.php on line 3215
Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in /www/wwwroot/dev.zhalaotie.com/wp-includes/wp-db.php on line 3215
class="post-53233 post type-post status-publish format-standard hentry">

WordPress How do I delete thousands of unattached images?

That’s a lot of unattached images. If you have couple of hundred images then you can delete them manually from media library.

1. Click 'Screen Options' at the top right and set 'Show on screen' to 200.
2. Click 'Apply'.
3. Click the checkbox just under 'Bulk Actions' to check all images on the page.
4. Select 'Delete Permanently' in the 'Bulk Actions' dropdown.
5. Click 'Apply'.


WordPress SQL query to delete all media and attachments

# 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';

 

发表评论

电子邮件地址不会被公开。