php – Filtering image class at output
Question
I would expect this (added to functions.php) to add “no-shadow” to all image output from the media library… it does nothing.
function jma_child_get_attachment_image_attributes( $attr, $attach ) {
$shadowless_imgs = array(9204);
//if(in_array($attach->ID, $shadowless_imgs))
$attr['class'] .= ' no-shadow';
return $attr;
}
add_filter( 'wp_get_attachment_image_attributes', 'jma_child_get_attachment_image_attributes', 10, 2 );
0
2 months
2023-02-02T17:46:01-05:00
2023-02-02T17:46:01-05:00 0 Answers
0 views
0
Leave an answer