WordPress append image dimensions as class names

When inserting images into post or page content WordPress automatically adds three class name to the image tag along with the other attributes, these are the alignment (alignnone), size (size-full) and the attachment id (wp-image-123).

If you need to add additional class names to the defaults without having to manually add them every time you insert a new image, you can make use of either the get_image_tag_class or get_image_tag filters. Continue reading “WordPress append image dimensions as class names”