Title: Filter srcset feature broken
Last modified: September 20, 2022

---

# Filter srcset feature broken

 *  Resolved [robertstaddon](https://wordpress.org/support/users/robertstaddon/)
 * (@robertstaddon)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/filter-srcset-feature-broken/)
 * The “Filter srcset” feature on the “Settings” tab is broken with the current 
   1.0.11 version of Easy Watermark. It does not filter out the srcset attribute
   to only contain image sizes watermarked the same way.
 * The reason for this is that the “_ew_applied_watermarks” meta key that you are
   storing on each media item is an array with the $watermark_id as the key and 
   the name as the value. However, the “get_allowed_sizes” function in your SrcsetFilter
   class (/src/classes/Features/SrcsetFilter.php) does a foreach on $watermarks 
   as $watermark_id, which assigns it the name of the watermark and not the ID. 
   This fails when you call Watermark::get, which is expecting the ID instead of
   the name.
 * The fix is simple, just change Line 159 to the following and your “Filter srcset”
   feature works again:
    `foreach ( $watermarks as $watermark_id => $watermark_name){`
 * With the above change, the $watermark_id variable then holds the array key, which
   is the actual watermark ID (and not the name), and this is exactly what your 
   Watermark::get function needs.
 * I would submit a pull request with this simple change on your Github page but
   your latest develop branch is at 1.0.6. If you would like to update it, I would
   be happy to fork your code and submit this as a pull request.

Viewing 1 replies (of 1 total)

 *  Plugin Author [Kuba Mikita](https://wordpress.org/support/users/kubitomakita/)
 * (@kubitomakita)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/filter-srcset-feature-broken/#post-16099449)
 * Thanks for reporting this! I’ll make sure to include it in the next version of
   the plugin.

Viewing 1 replies (of 1 total)

The topic ‘Filter srcset feature broken’ is closed to new replies.

 * ![](https://ps.w.org/easy-watermark/assets/icon.svg?rev=2153955)
 * [Easy Watermark](https://wordpress.org/plugins/easy-watermark/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/easy-watermark/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/easy-watermark/)
 * [Active Topics](https://wordpress.org/support/plugin/easy-watermark/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/easy-watermark/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/easy-watermark/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Kuba Mikita](https://wordpress.org/support/users/kubitomakita/)
 * Last activity: [3 years, 7 months ago](https://wordpress.org/support/topic/filter-srcset-feature-broken/#post-16099449)
 * Status: resolved