Forums

Encoding ampersands from output of wp_head() (1 post)

  1. Grubbyseismic
    Member
    Posted 12 months ago #

    I've come across a problem getting my markup to validate (I'm picky about such things).

    Basically, the call to wp_head(); in my HEADER.PHP introduces the line <link rel="alternate" type="application/rss+xml" title="My Blogname &raquo; Search Results for “query1 query2” Feed" href="http://myURL/?s=query1+query2&feed=rss2" /> into the header.

    Fair enough, that's what it's meant to do.

    Unfortunately, I can't encode the ampersand given in the output, this throws a markup-validation error.

    I've tried searching the boards, the nearest relative issue was from 6 years ago and never resolved (http://wordpress.org/support/topic/wp_head-creates-invalid-markup).

    I've tried using esc_attr, esc_html and their alternatives / derivatives, directly accessing the output and encoding a variable. Nothing works.

    In the end I've have had to remove_action in FUNCTIONS.PHP. Not an ideal solution, as my client may ask for RSS-related links in the future (although I have set a workaround).

    Any ideas?...

Reply

You must log in to post.

About this Topic

  • RSS feed for this topic
  • Started 12 months ago by Grubbyseismic
  • This topic is not resolved
  • WordPress version: 3.1.3