Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
  • #276485

    Hello, there is only title tag for Featured image in single post. Is it possible to set alt tag same as title tag?

    Please help me, it is already 2 days I’m trying to set alt tags without any success.

    Here is the link to my single post.

    Thank You


    Hey georgedz!

    You can set Alt Text on right side of featured image uploading screen as shown here – http://i.imgur.com/6XaXxb0.png



    Hi Yigit, thanks for your answer. The problem is that I’m uploading a lot of pictures and I can’t go through each image. I just want to set alt text same as image name or post title.

    I know that this is beyond free support but please please help :)



    Hi George,

    Try adding this at the very end of your theme functions.php file:

    function add_custom_script(){
    	   jQuery("img").attr("alt", jQuery("title").text());    
    add_action('wp_footer', 'add_custom_script');



    Thanks Josue, I have added the script but it seems that nothing has changed : (

    Even when I add alt text through attachment details as shown here http://i.imgur.com/6XaXxb0.png
    For example I have added alt text for this post and when I check the source code there is no alt tag, only title
    a rel=”lightbox[grouped]” href=”http://animalpictures.gallery/wp-content/uploads/Lao-Tzu.png” title=”test test test”

    Is there any other option you can think of?

    Many thanks guys

    • This reply was modified 5 years, 3 months ago by  georgedz.

    Seems to be working for me (the value that’s getting applied to the Alt tag is the one of the Title tag:

    Note that this is getting applied to the singular view:
    http://animalpictures.gallery/ (Purchase code hidden if logged out) -noyoucant-ladies-750/

    Best regards,


    I’m now looking at the source code and alt tag is empy, is there an alt tag for you?
    Here is the screenshot of the source code, am I doing something wrong? : )
    Screen shot

    Thank you Josue,


    Yes, you won’t see it there because it’s being added via JavaScript after the page is loaded.



    Oops, it is because of SEO I want to set alt tags :) Thank you Josue for your time, i really appreciate your help.
    Is there anything alse I can do?
    I was searching something to edit in single.php without any success. I guess i need to add alt=”<?php the_title(); ?>”
    somewhere as suggested in a post below.
    http://wordpress.stackexchange.com/questions/57968/ (Purchase code hidden if logged out) -tag-for-featured-image
    But can’t make it work




    We use the get_the_post_thumbnail() function ( http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail ) in wp-content/themes/enfold/includes/loop-index.php to fetch the featured image. This function adds the alt text automatically if the “Alternative text” field on the attachment page isn’t empty: http://www.clipular.com/c/6364087445356544.png?k=h684IvqFw7AVyUGNT6s1kYbNZ-s

    Best regards,

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.