• Resolved Hawaii Loves Art

    (@hawaii-loves-art)


    hello, the library has some images with too many sizes that are unwanted or needed. so I was given this code and told to paste it into child theme-php functions editor and this would remove those extras. the code can be written to target any specific class of images. Inserted the code but nothing changed, no images deleted. Is the code wrong, did I put in the child theme incorrectly?

    add_action(‘init’, ‘disable_thumbs’);
    function disable_thumbs(){
    remove_image_size(‘portfolio-full’);
    remove_image_size(‘recent-posts’);
    remove_image_size(‘recent-works-thumbnail’);
    remove_image_size(‘blog-large’);
    remove_image_size(‘blog-medium’);
    remove_image_size(‘related-img’);
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    It shouldn’t delete the images, it just won’t generate those additional thumbnails when a new images are added to the media library

    Thread Starter Hawaii Loves Art

    (@hawaii-loves-art)

    yes thanks. went thru the images upload folder and deleted tons of unwanted ones. added a new image as a test and got it down to only 5 copies. I believe WP creates 4 so only one odd one out.

    btw image folder size dropped from 13MB to only 5, big diff.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘remove duplicate images from library|’ is closed to new replies.