I have been looking for a couple of days for a filter for the WordPress gallery. I have tried many different codes but nothing seems to work for it. I am not using a plugin. I am talking about the stock gallery
I created a 2 column WordPress gallery and inserted it into a page. This did make a 2 column gallery but it also made the image sizes to 128 x 49. The site is responsive and the image sizes should be around 400 by 200. So I thought that if I could get WordPress to take out the inline height and width that the responsive part would take over and fill the available space. The filters that I have tried have worked on other images just not the gallery. I am using the 2014 theme and it's media queries. Is there a specific filter for the gallery?
Here is the filter I am using for other images
add_filter('wp_get_attachment_link', 'remove_img_width_height', 10, 1);
function remove_img_width_height($html) {
$html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html );
return $html;
}
post_gallery
is that filter. You might need to adapt the specific filter to your purposes, but that's the right place to start.