Skip to content

Instantly share code, notes, and snippets.

@jawngee
Created Nov 26, 2020
Embed
What would you like to do?
<?php
// Add this to your theme's functions.php
// This filter will insure that the wp-image-{IMAGEID} class is added to your
// image tags, allowing media cloud to work more optimally
add_filter('wp_get_attachment_image_attributes', function($attrs, $attachment, $size) {
if (!empty($attachment) && isset($attrs['class'])) {
$attrs['class'] .= ' wp-image-'.$attachment->ID;
}
return $attrs;
}, PHP_INT_MAX, 3);
@stephenfeather
Copy link

stephenfeather commented Dec 23, 2021

Hey man, thanks for sharing this. Media Cloud is a great plugin with horrific support. (I have 2 serious issues opened for 2 months now and I paid for the thing). Good to see users coming up with solutions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment