WordPress.org

Support

Support » Alpha/Beta » comments_popup_link tag does not validate as XML with ampersands in title

comments_popup_link tag does not validate as XML with ampersands in title

  • In previous versions, the comments_popup_link produced code that looked something like this:
    <a href="pageurl/#comments" class="commentslink">Comments</a>

    However, in 2.0, the same page template will produce this instead.

    <a href="pageurl/#respond" class="commentslink" title="Comment on Post title">Comments</a>

    Note the addition of the title attribute.
    All works fine most of the time. However, when the post title contains an ampersand character, then the source shows up as something like title="Comment on Post title with & in it"> rather than escaping the ampersand as &amp;.
    Where this occurs, the page will no longer validate correctly as XHTML.

Viewing 2 replies - 1 through 2 (of 2 total)
  • It seems to work fine as long as you escape the ampersand in the Title yourself. If you don’t them the comments do come out with an error and won’t validate.

    Trip

    This is pretty awkward if it is the only way to solve the problem.

    I’l probably end up writing my own function to try & fix this. It must be fairly simple to update how it works, as the title etc allready escape the ampersands correctly.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘comments_popup_link tag does not validate as XML with ampersands in title’ is closed to new replies.
Skip to toolbar