How do I stop specific images from being optimized?
2 min read · Last updated June 2026
Add a keyword to Custom exclusions in the settings, and SlashImage skips any image whose filename or URL contains it.
Add an exclusion
- Go to Media > SlashImage and open the Settings tab.
- In the Image Size Exclusions section, find Custom exclusions and click Edit Exclusions to open the editor.
- Type one pattern per line, for example
logoon one line andfaviconon the next. - Close the editor, then click Save changes on the settings page.
How matching works
- A pattern matches as plain text anywhere inside the filename or the URL, so
logoskipslogo.png,site-logo-2x.jpg, and anything in a/logos/folder. - Matching is case-insensitive:
Logo,logo, andLOGObehave the same. - You can add up to 100 patterns, each up to 200 characters long.
Check it worked
An excluded image shows Excluded (matches: <pattern>) in the SlashImage Media Library column, naming the pattern that caught it. See What does the SlashImage column show?.
For developers
To decide exclusions in code, use the filter (it runs after the Custom exclusions patterns):
apply_filters( 'slash_image_should_skip_attachment', false, $attachment_id, $filename, $url )Return true to skip the attachment, or a non-empty string to skip it and show that string as the matched pattern. See Actions and filters for developers.
See also
Was this helpful?