Posted on Leave a comment

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

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.

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(

Paste code an exact location check image bellow

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 ) ) {

Paste code at exact location check image bellow

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.

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 *