As you may have noticed, EWWW IO has a lot of ways that you can override the default behavior. Additionally, it is possible to override any setting that is a boolean (true/false) or an integer (non-decimal number) by defining the constant with the same name. This can be particularly helpful for some settings that have been removed from the settings interface due to the small number of sites using them.
First of all, let's see an example of how this works. To override anything within the EWWW IO plugin, you define a "constant" in your wp-config.php file. This is the file where your database connection details are stored, as well as a few other settings that are global within WordPress. The wp-config.php file is located right in the root of your WordPress install folder, often right inside the public_html folder or a similar location.
Defining a constant looks something like this:
define( 'EWWW_IMAGE_OPTIMIZER_DELAY', 5 );
Here the option name is normally 'ewww_image_optimizer_delay', but it is in all-caps, which is typical for constants within PHP and WordPress. The Bulk Delay setting makes the bulk optimizer and scheduled optimizer "sleep" for 5 seconds in between images. This helps to avoid overloading a server, and can be very useful on shared hosting. The setting can also be changed directly on the Bulk Optimizer page, which is why it is being removed from the settings page.
Important: For all overrides, make sure that you insert the option above where it says to stop editing. There will always be a line in your wp-config.php that says something like "That's all, stop editing!". Adding anything below that line will not have any effect. Also, make sure you do not use quotes around boolean (true/false) and numerical values or this will turn them into strings, like 'something', 'false', or '8'.
This first list includes only those settings that are hidden from the settings page:
EWWW_IMAGE_OPTIMIZER_NOAUTO - (true/false) Set to true to turn off automatic optimization of your images. You can optimize them manually, or using Scheduled optimization instead. This setting was removed from the settings page a long time ago, but is still used in the code and can now be turned on with a constant instead of having to mess with your database options.
EWWW_IMAGE_OPTIMIZER_DISABLE_EDITOR - (true/false) EWWW IO is the only plugin to feature automatic optimization for every single image created by the built-in image editing functions. In rare cases, this can cause issues, set this to true to disable the image editor integration.
EWWW_IMAGE_OPTIMIZER_DISABLE_AUTOROTATE - (true/false) The plugin automatically rotates images that have an orientation flag set in their metadata to prevent your images from going sideways, literally. Set to true to suppress this auto-correction.
EWWW_IMAGE_OPTIMIZER_DISABLE_AUTOCONVERT - (true/false) The plugin automatically checks newly uploaded PNG files to see if they should have been saved as JPG instead, and will convert them as necessary. This happens very early in the process, so it's quite safe, but if you have some reason to preserve large PNG images, by all means, set this to true.
EWWW_IMAGE_OPTIMIZER_DEFER_S3 - (true/false) Prevents the WP Offload S3 plugin from uploading images to S3 until after optimization is complete. This can cause the appearance of missing images temporarily, so use with caution.
EWWW_IMAGE_OPTIMIZER_OPTIPNG_LEVEL - (1-4) Optipng runs a certain number of "trials" to determine the best compression parameters for an image. The default level is 2 (8 trials), you can decrease that to 1 (1 trial) if large PNG files are taking too long, or you can increase it to 3 (16 trials) or 4 (24 trials) to ensure maximum compression.
EWWW_IMAGE_OPTIMIZER_PNGOUT_LEVEL - (3-0) The default here is again 2, and it has a reverse scale: 3 is lowest compression, 0 is the highest. Level 3 doesn't do much more than what Optipng has already done, so if you're going to use PNGOUT, it's recommended to use level 2 or better.
EWWW_IMAGE_OPTIMIZER_DISABLE_PNGOUT - (true/false) Set this to false to enable use of the PNGOUT compression tool. It can't be bundled with the plugin, but you can install it automatically via the Plugin Status section (after it is enabled) or manually in the wp-content/ewww/ folder. If the latest version doesn't work, you can try older versions manually.
EWWW_IMAGE_OPTIMIZER_SKIP_SIZE - (0 or greater) Number of bytes, any image smaller than this number will not be optimized. Set to 0 to disable it.
EWWW_IMAGE_OPTIMIZER_SKIP_PNG_SIZE - (0 or greater) Number of bytes, and opposite of the previous setting. Any PNG image larger than this size will not be optimized. Set to 0 to disable.
EWWW_IMAGE_OPTIMIZER_LOSSY_SKIP_FULL - (true/false) Excludes full-size (original) images from lossy compression. Lossless compression will be applied instead.
EWWW_IMAGE_OPTIMIZER_METADATA_SKIP_FULL - (true/false) Excludes full-size (original) images from metadata removal.
EWWW_IMAGE_OPTIMIZER_SKIP_BUNDLE - (true/false) Tells the plugin not to install the bundled optimization utilities and use system-level binaries instead. For example, if you installed jpegtran, optipng, and gifsicle via yum or apt, you may wish to use those versions instead of the ones included with EWWW IO. I really don't recommend it, but you can if you want to.
Above, I showed you how to define a setting that is numeric, but several of these are simply on/off type settings. We call these boolean (true/false) values, and you can set them like so:
define( 'EWWW_IMAGE_OPTIMIZER_NOAUTO', true );
Like I said before, any option that is an on/off toggle, or is numeric can be configured the same way.
To that end, this second list (work in progress) is the current options that are displayed in the UI which can be configured in wp-config.php:
EWWW_IMAGE_OPTIMIZER_METADATA_REMOVE - (true/false) If set to true, it will remove metadata. Set it to false to preserve metadata.
EWWW_IMAGE_OPTIMIZER_JPG_LEVEL - (0, 10, 20, 30, 40) A zero is no compression, level 10 is Pixel Perfect (lossless), level 20 is Pixel Perfect Plus (lossless via API), level 30 is Premium (lossy), and level 40 is Premium Plus (maximum lossy).
EWWW_IMAGE_OPTIMIZER_PNG_LEVEL - (0, 10, 20, 40, 50) A zero is no compression, level 10 is Pixel Perfect (lossless), level 20 is Pixel Perfect Plus (lossless via API), level 40 is Premium (lossy), and level 50 is Premium Plus (maximum lossy). Yes, level 30 is missing, because it is an old setting that has become obsolete.
EWWW_IMAGE_OPTIMIZER_GIF_LEVEL - (0 or 10) A zero is no compression, and level 10 is Pixel Perfect (lossless).
EWWW_IMAGE_OPTIMIZER_PDF_LEVEL - (0, 10, 20) A zero is no compression, level 10 is Pixel Perfect (lossless), level 20 is high quality compression. Level 20 for PDFs doesn't get the premium designation, as it's just a raw image down-sampler, which can have issues if any images have text within them.
EWWW_IMAGE_OPTIMIZER_BACKUP_FILES - (true/false) This enables backups via the compression API, stored for 30 days.
EWWW_IMAGE_OPTIMIZER_JPG_QUALITY - (0-100) Overrides the default WordPress quality of 82. Does not generally affect EWWW IO compression, but is applied to any resizing, editing, and conversion functions.
EWWW_IMAGE_OPTIMIZER_PARALLEL_OPTIMIZATION - (true/false) Depends on background optimization, allows the plugin to compress thumbnail/resize images in parallel after a new image upload.
EWWW_IMAGE_OPTIMIZER_AUTO - (true/false) Not to be confused with the "noauto" setting, this one enables/disables Scheduled Optimization. While it IS available in the settings, it can be helpful to disable this on staging/development sites so that it only runs in production.