Title: request: apply_filter for $attributes
Last modified: June 9, 2023

---

# request: apply_filter for $attributes

 *  Resolved [cgzaal](https://wordpress.org/support/users/cgzaal/)
 * (@cgzaal)
 * [3 years ago](https://wordpress.org/support/topic/request-apply_filter-for-attributes/)
 * Hi, I’m using your gallery plugin (big fan).
 * For some reason I want to tag some images via css (with a red dot), so I need
   an extra class to be set in the gallery. I managed to do this adding a filter
   to the $attributes variable, so I could add an id to the <figure class=”mgl-item”
   >.
 * Could you add an apply-filters line to the $attributes variable (in the build_next_cell
   function)? This would be really cool!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Frequest-apply_filter-for-attributes%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [Jordy Meow](https://wordpress.org/support/users/tigroumeow/)
 * (@tigroumeow)
 * [3 years ago](https://wordpress.org/support/topic/request-apply_filter-for-attributes/#post-16809994)
 * Hi,
 * In core.php, if I do this:
 *     ```wp-block-code
       $attributes = $this->build_inline_attributes( $id, $data );
       $attributes = apply_filters( 'mgl_attributes', $attributes, $id, $data );
       if ( !empty( $attributes ) ) {
       	$attributes = ' ' . $attributes;
       }
       ```
   
 * Does this work for you? 🙂
 *  Thread Starter [cgzaal](https://wordpress.org/support/users/cgzaal/)
 * (@cgzaal)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/request-apply_filter-for-attributes/#post-16816586)
 * Hi Jordy, that would be great! –Chris

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

The topic ‘request: apply_filter for $attributes’ is closed to new replies.

 * ![](https://ps.w.org/meow-gallery/assets/icon-256x256.png?rev=2791571)
 * [Meow Gallery](https://wordpress.org/plugins/meow-gallery/)
 * [Support Threads](https://wordpress.org/support/plugin/meow-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/meow-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/meow-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/meow-gallery/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [cgzaal](https://wordpress.org/support/users/cgzaal/)
 * Last activity: [2 years, 12 months ago](https://wordpress.org/support/topic/request-apply_filter-for-attributes/#post-16816586)
 * Status: resolved