Support » Plugin: Image Widget » "Alternate Text" field not used

  • Resolved adoliver


    Steps to Reproduce:
    1) add widget to sidebar
    2) upload new image
    3) Fill out all fields on widget page
    4) Inspect rendered source code

    Expected Behavior:
    “Alternate Text” field should be inserted into the alt attribute for the image tag.

    Actual Behavior:
    The alt attribute attached to the image takes its text from the “Title” field instead of the “Alternate Text” field. If no title is provided then no value is assigned to alt.

    I could potentially understand the “Title” field being used in place of the “Alternate Text” field if the “Alternate Text” field was left blank. It does not make sense to have the “Title” field trump the “Alternate Text” field because they are doing two completely different things. The “Title” is displayed in the widget and it is not always desired to have text surrounding the image. The “Alternate Text” is intended for search engines, handicap support and unloaded images–as such it is very likely to have different more descriptive text than the title.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Follow Up:

    The “Alternate Text” field is populated by the “Alternate Text” field from the wordpress media tool. However it does not get applied to the image, which is confusing.

    After playing with the widget some more I figured out that the “Alternate Text” field is being applied to the LINK TAG alt attribute. Which was very unexpected due to the presentation in your form.
    1) Your widget form is confusing
    2) The alt text is being added to the wrong element

    If #1 is the case I would recommend having the “Alternate Text” field listed after the “Link” field and change the name to “Link Alternate Text”

    I believe this is the same problem as reported here?

    Does anyone know why my images are all showing up with a blue box around them?? Only in Internet Explorer 9 does this happen and it looks horrible..

    Here is the website:

    RachelinBranson, that is a CSS issue with Explorer. Try this in your stylesheet:
    img { border: none; }
    But this is not the place for such an issue.

    As an note to the developer (and to help others in the meantime), a solution for this issue was provided in this thread:

    The code in image-widget.php has changed since the fix in paracleteweb’s link above.

    In 4.0.8 I’ve now just changed line 279 to
    $instance['alt'] = $new_instance['alt'];
    to now generate the alt text properly.

    whilst this fixes the alt text, it now also makes the title element show as the alt text! Taking the original fix as a starter, in 4.0.8 I’ve changed line 505 to
    'title' => ( !empty( $instance['title'] ) ) ? $instance['title'] : $instance['alt'],
    which gets the title to render properly again.

    I’m on 4.0.8, but alt text did not show until I set a title, which I then hide with CSS 🙁

    Plugin Author Peter Chester


    Thank you all for your patience on this. Sorry, I’ve been unable to get to this for a while but I’m going to release an update in the next few days that fixes this.


    Plugin Author Peter Chester


    Ok, this is deployed. I welcome any ratings and especially clicks on the ‘Works’ with 3.9 button. Thanks!

    Plugin Author Peter Chester


    Oh, and this is resolved. 🙂

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘"Alternate Text" field not used’ is closed to new replies.