Every time I add a post with images it turns them into a block with a figure element around my image. Then I click edit as HTML, and add a “center-block” to my image.
I have to repeat this step for every single image in the post. Is there a way for WordPress to do this automatically? Or is there a different method to apply the center-block class to images in my post?
I had asked ChatGPT and it came up with the following code which doesn’t seem to do anything:
`function add_image_class($class){
$class .= ‘ custom-class’;
return $class;
}
add_filter(‘get_image_tag_class’,’add_image_class’);`