How to Add Title Tag for all WordPress Images Solve in One Step Image SEO Optimize

Your website overflowing with images without titles. As you may have noticed WordPress doesn’t add title attribute to any post images, fix this problem. Title attributes mainly use for mouse hover Tool-tip which greatly improves readability for readers. In this tutorial we will go over WordPress hook to add Title Attribute only one step to activate title tag for all WordPress images.

WordPress add title to image all attributes mainly use for mouse hover

Image title attributes are very easy to add. There are many ways but i will show you the simplest and the latest ways to add them a three word of code; without plugin or no plugin request, I will demonstrate how to add title tags for images using this methods.

What is Image Title

Generally, Image title is basically the name of your image. Like alt text, it lets users and search engines know what’s in the picture. Unlike alt text, the image title is not displayed when the image is missing or not loaded properly. Instead, it is displayed when the user hovers their mouse over the image.

Step-1 Add Title Tag to all Feature Images

Just simply pool below code to your WordPress file wp-includes → media.php

'title'   => $attachment->post_title,

You can find this line bellow mention

$default_attr = array(
Find default_attr to add title tag to all WordPress feature images

Paste code an exact location check image bellow

Find and paste this code add title tag to all WordPress feature images

Step-2 Add Title Tag to all Post Images

The same file location wp-includes → media.php

title="'.trim( strip_tags( get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) ) ).'"

You can find this line below mention

if ( is_string( $sizes ) ) {
Find this line if(is_string to add all WordPress post images page image and all

Paste code at exact location check image bellow

Find and paste this code to add title tag to all over WordPress images

Now you add an image to post you will see title attributes will be added automatically as you see in Insert image screen below. Select the image from the media library. On the right-hand side, you should see some text boxes. Fill out the Title text box and click on the “Insert into page” button.

Select image on media library Fill title text

Note, above tricks will work all images with the title already made. I would strongly recommend to add nice title to each images for user’s mouse hover Tooltip. Eventually better organized blog/site will lead you to the success you want one day.

Leave a Reply

Your email address will not be published. Required fields are marked *