Filtering the Gallery Image Output in WordPress – Adding Class or Data Attribute

WP Beaches ~
To manipulate the linked images, specifically the links themselves in the WordPress Gallery output for doing things like adding in a CSS class or a data attribute value you can use the post_gallery filter in /wp-includes/media.php which is the right tool for the job.
The filter can be applied like so…
View this code snippet on GitHub.
So this is an
Leave a Reply