Support » Plugins » Hacks » Encoding ampersands from output of wp_head()

  • Grubbyseismic


    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 (

    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?…

  • The topic ‘Encoding ampersands from output of wp_head()’ is closed to new replies.