I am using Imagick with WP 5.0.3. Since version 4.5 WordPress use Imagick to create/resize thumbnails and it keeps EXIF/IPTC metadata (using GD, metadata are removed).

WordPress keep EXIF/IPTC metadata in thumbnails, but I would like to create new thumbnails without them, to remove metadata. There is image_strip_meta filter, but I can not make it work how I would like, to remove metadata. I put this inside my functions.php (inside my theme), but nothing, new thumbnails still have metadata:

add_filter ('image_strip_meta', false); // Aslo tried with "true"

I read that there were bug in WP about this (I don't know if it is fixed).

Could you please tell me what would be right way to remove metadata from thumbnails?

  • The second parameter of add_filter needs to be a callable. So it should be add_filter ('image_strip_meta', '__return_true' ); Although the default is to strip the metadata, so I don't know why your thumbnails still have the metadata. – Nathan Johnson Feb 2 '19 at 17:50
  • I tried your updated code, but metadata (exif is still present in new thumbnails, it is not removed). Any idea why? – Advanced SEO Feb 3 '19 at 17:40

The Imageick strip_meta function is only called if the image_strip_meta hook returns true, but the function doesn't actually strip all profiles. Some are protected, as you can see in the function code:

     * Protect a few profiles from being stripped for the following reasons:
     * - icc:  Color profile information
     * - icm:  Color profile information
     * - iptc: Copyright data
     * - exif: Orientation data
     * - xmp:  Rights usage data
    $protected_profiles = array(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.