How to Easily Add Title Attribute to Images in WordPress
Recently we showed you the difference between alt text vs image title and how to use them for images on your WordPress blog. One of our users asked us for an easier way to add title attribute to images in WordPress. The default media uploader does not have an option to add title attribute. In this article, we will show you how to easily add title attribute to images in WordPress.
What is the Title Attribute in Images?
In HTML, images are displayed by using img tag. Like this:
<img src="/path/to/image/fruits.jpg" width="100" height="100" />
However, web crawlers and bots can not see your images. To help search engines and bots you can add an alternate text attribute to your image tag. This alternate tag attribute describes what your image is showing. Like this:
<img src="/path/to/image/fruits.jpg" width="100" height="100" alt="A fruit basket" />
The alternate tag is also displayed when a image is not found or when a browser is unable to load images. Like this:
To make things easier for users with screen readers and special needs, you can also add a title attribute to the image. Like this:
<img src="/path/to/image/fruits.jpg" width="100" height="100" alt="A fruit basket" title="Fruit Basket" />
This title attribute appears in a popup when a user takes the mouse over to an image. Users with screen reader software can configure their software to read this title.
Using both the alt text and title attribute improves the performance of your images in search engines. It also helps many users with special needs to be able to understand your web pages.
The Problem
You can add a title to your images in WordPress when uploading them using the default media uploader. However, this title is used by WordPress internally, and it is not the same as the title attribute used inside the image tag in HTML.
To add the title attribute, you will have to switch to text editor or edit an image after inserting it. That sounds like a lot of extra work if you upload lots of images to your WordPress site. Here is how you can fix it.
Video Tutorial