plugins - Clear out old images, any advice?

I'm working on a site which has a media library that is now 7GB - and I really want to clear out all the unused ima

I'm working on a site which has a media library that is now 7GB - and I really want to clear out all the unused images.

I've tried using the Media Cleaner Plugin: / But this seems to clear out images that I am using - this seems to be because my whole site is built with Advanced Custom Fields.

Does anyone have any suggestions on how I could delete images that aren't being used?

Thanks.

I'm working on a site which has a media library that is now 7GB - and I really want to clear out all the unused images.

I've tried using the Media Cleaner Plugin: https://wordpress/plugins/media-cleaner/ But this seems to clear out images that I am using - this seems to be because my whole site is built with Advanced Custom Fields.

Does anyone have any suggestions on how I could delete images that aren't being used?

Thanks.

Share Improve this question asked Apr 25, 2019 at 11:41 M.TM.T 351 silver badge5 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

I think you have already discovered the problem with a plugin approach. They will look for unlinked media (images not associated with a post) and remove those files. As you have said, you are using custom fields and you may also have uploaded images inside your post content.

Sadly the only option I can think of is to use a find command to get a list of all of your wp-content/uploads and then reduce that list by removing all images in use. As a starting point, you could try the WP-CLI database search command.

You'd want to allow for the different generated image sizes given that a thumbnail or medium image may be used, but you'd want to keep the original + all scaled variants.

It goes without saying that you should have a full backup of your database and files before running anything like this!

I'd be interested if someone can provide a more elegant and robust solution, but this is probably how I'd approach the problem.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745553801a4632698.html

相关推荐

  • plugins - Clear out old images, any advice?

    I'm working on a site which has a media library that is now 7GB - and I really want to clear out all the unused ima

    4小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信