Title: Bypass EWWW programatically?
Last modified: August 21, 2016

---

# Bypass EWWW programatically?

 *  [niska](https://wordpress.org/support/users/niska/)
 * (@niska)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/bypass-ewww-programatically/)
 * Hi
 * I’m adding a lot of thumbnails programatically. Is there a way to bypass EWWW
   when doing this? These images don’t need to be optimized.
 * I’m using wp_insert_attachment() and wp_update_attachment_metadata() to add new
   thumbnails.
 * Thank you
 * [https://wordpress.org/plugins/ewww-image-optimizer/](https://wordpress.org/plugins/ewww-image-optimizer/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Shane Bishop](https://wordpress.org/support/users/nosilver4u/)
 * (@nosilver4u)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/bypass-ewww-programatically/#post-4620441)
 * The correct answer is ‘maybe’…
 * If you call the function ewww_image_optimizer_update_table() and provide it with
   the parameters defined, a record will be created telling EWWW that they have 
   already been optimized. I would not recommend this unless you KNOW that your 
   generated images are fully optimized. Check a few in the ewwwio_images table 
   by going to Bulk Optimize and clicking the Show Optimized Images button.
    The
   required parameters for the function are: $attachment = the full/absolute path
   to the image $opt_size = the image size after optimization $orig_size = the image
   size before optimization
 * In your case, you can pass the same size for $opt_size & $orig_size, but it must
   be the actual filesize of the image, or it will not be bypassed by EWWW.
 * However, if you are using the WP_Image_Editor classes to create the images in
   the first place, there will be absolutely no way to bypass it, as the plugin 
   is hooked directly into the save() function of the image editor class.
 *  Thread Starter [niska](https://wordpress.org/support/users/niska/)
 * (@niska)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/bypass-ewww-programatically/#post-4620529)
 * It would be great to have a filter that I could use to return false if optimization
   is not needed at some point in the code. Could you maby add that in the future?
 *  Plugin Author [Shane Bishop](https://wordpress.org/support/users/nosilver4u/)
 * (@nosilver4u)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/bypass-ewww-programatically/#post-4620652)
 * sticking this as a feature request. I’ll take a look at it next week and see 
   if it is even feasible.
 *  Plugin Author [Shane Bishop](https://wordpress.org/support/users/nosilver4u/)
 * (@nosilver4u)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/bypass-ewww-programatically/#post-4620676)
 * Well, took me a lot longer to get back to this than I thought, but the filter
   will be in the next release (next week).
 *  Thread Starter [niska](https://wordpress.org/support/users/niska/)
 * (@niska)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/bypass-ewww-programatically/#post-4620677)
 * Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Bypass EWWW programatically?’ is closed to new replies.

 * ![](https://ps.w.org/ewww-image-optimizer/assets/icon-256x256.png?rev=1582276)
 * [EWWW Image Optimizer](https://wordpress.org/plugins/ewww-image-optimizer/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ewww-image-optimizer/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ewww-image-optimizer/)
 * [Active Topics](https://wordpress.org/support/plugin/ewww-image-optimizer/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ewww-image-optimizer/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ewww-image-optimizer/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [niska](https://wordpress.org/support/users/niska/)
 * Last activity: [12 years, 2 months ago](https://wordpress.org/support/topic/bypass-ewww-programatically/#post-4620677)
 * Status: not a support question