WordPress.org

Forums

How to auomatically insert image alt and title (5 posts)

  1. Mohsin10
    Member
    Posted 1 year ago #

    Hi,

    Is there a way to automatically use my post title as alt and title attributes for all of the images in my content (as well as featured image aka post thumbnail)?

    I have already tried SEO Friendly Images Plugin http://wordpress.org/plugins/seo-image/ but it doesn't give me the desired results.

    Please note that manually inserting alt and title attributes for images in the media editor is not an option, because I have hundreds of Images on my site and I add dozens more daily. I'm looking for an automated way.

    Thanks for your kind help.

  2. Krishna
    Volunteer Moderator
    Posted 1 year ago #

    Do you want to insert the same title and alt tags to all the images? Don't you think that they can create the problem of duplicate tags?

  3. Mohsin10
    Member
    Posted 1 year ago #

    Yes Krishna, that's what I want.

    The thing is, a lot images have very vague and non-user-friendly names such as 'img59595'. Since WordPress currently uses the image name as its alt attribute (and nothing for title if you left it empty when uploading), I bet it neither makes sense to search engines nor the users.

    Using the same alt and title attribute for all images on a page may not be ideal, but it solves my problem.

  4. Krishna
    Volunteer Moderator
    Posted 1 year ago #

    Using the same title and alt tags for all images is worse than using different non-user-friendly names such as 'img59595' as they are at least different and will not attract penalization from search engines such as Google for multiple duplicates.

  5. Mohsin10
    Member
    Posted 1 year ago #

    Ok, I might not do that. But I'd still like to know how to add alt and title attribute to the featured image thumbnails I'm pulling this way:

    <?php if ( has_post_thumbnail()) : ?>
    
                                <?php the_post_thumbnail(); ?>
                                <?php else : ?>
                                <span class="from_the_portfolio_noimg">
                                <?php endif; ?>

    I do have custom title and tag attribute defined for thumbnail images, but for some reason the alt and title tags are empty on the images rendered on my page. Any idea why?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags