wordpress image attachment

WordPress image attachment is a little complicated thing. In a post that is inserted an image attachment, you can edit some attributes like alt text, height, width of the inserted image.¬†This editing won’t change the image itself, but change the corresponding attributes of the <img> element in the post. If you click the pencil icon on the editor menu of the image block, you can edit more attributes about the image including Alt Text, Title, Caption, Description on the pop up “Select or Upload Media” window and the “Media Library” tab. The Alt Text is still to be the alt attribute of the <img> element, but the other attributes Title, Caption, Description are not part of the <img> element. The Caption attribute forms the inner text of the <figcaption> element below the <img> element. The other two attributes Title and Description, however, do not occur in the post that the image is inserted into. So what are Title/Description used for?

Click the “Edit Image” link on the popped up “Select or Upload Media” window, you will edit the attachment itself like in a normal post. Here you can edit the Title/Description like editing the title/content of a normal post. Besides, you can change the Alternative Text/Caption of the image. But unlike editing post which means changing the content of a post, editing an image means changing the pixels of the image. So here you can find new menu items to actually change the appearance of the image like cropping, rotating, etc. If you do some editing and click the “Save” button beneath the image, new resulting image files will be generated in the upload directory of WordPress. Click the “Permalink”, you will see the web page for the attachment(not the webpage for the post that contains the image), and the image on that page is updated.¬† However, the other elements such as the title/description of the attachment web page won’t change until you click the “Update” button, which is exactly the same as you are editing a post.

The post that contains the image, however, won’t change. It still refers to the old image, old alt, and old caption.



If you like my content, please consider buying me a coffee. Buy me a coffeeBuy me a coffee Thank you for your support!

Leave a Reply