• Hi,

    The setting for “Automatically set the alt attribute” isn’t working correctly.
    It is setting the title attribute of the image to the page that the image is uploaded to (attached to) rather than the page it’s displayed on. If an image is used in multiple places it shows the original title.
    That is also a problem though. It should really take the title from the media library first before the page title.

    Am I correct? Can this be adjusted?

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello.

    Please read the annotation for this option carefully. There is a template for the current page title – %title

    View post on imgur.com

    I just checked and it works as it should.

    Thread Starter infosws

    (@nicksws)

    Hi,

    That screenshot was great but I don’t see those options in this version (1.6.4).

    The only option I see is under SEO, Basic SEO optimization settings, and on/off switch for “Automatically set the alt attribute”.

    Where do we find these other options?

    Thanks.

    In the screenshot I sent, there is a component that is only available in the premium version of the plugin.

    The “Automatically set the alt attribute” option assigns the alt attribute from the title of the current post, and the title attribute is taken from the image title field in the media library. The image title often includes the name of the image itself, which is not related to the title of the post

    Thread Starter infosws

    (@nicksws)

    Hi,

    This is my point. They’re not.
    The alt and title attributes are taken from the title of the post that the image was uploaded to, not the current one. No matter what page the image is included on.

    e.g.
    <img width="425" height="222" src="https://example.com/wp-content/uploads/my-image.jpg" class="attachment-full size-full" alt="Test Course Display" srcset="https://example.com/wp-content/uploads/my-image.jpg 425w, https://example.com/wp-content/uploads/my-image.jpg 300w" sizes="(max-width: 425px) 100vw, 425px" title="Test Course Display" />

    “Test Course Display” is the title of the page I tested the feature on, not the current page. It’s also not the title field from the media library either.
    The alt attribute will change if I add an alt in the media library.

    I looked at your code:
    plugins/clearfy/includes/classes/class.configurate-seo.php
    function change_attachement_image_attributes (line 148)

    It’s pulling the title from the parent (which is the page it was uploaded to), not the current page (because it’s using $parent).

    I played with the code in a sandbox and found it.

    Please could you look at this?

    Thanks.

    This is what I wrote to you: the plugin takes the title from the media library. In the media library, the title is assigned when the image is uploaded and taken from the title of the post to which you attach the image. This is how WordPress works. If you want to change this logic, use the premium component I wrote about earlier

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Image title attribute incorrectly set’ is closed to new replies.