Encoding ampersands from output of wp_head()
-
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 » Search Results for “query1 query2” Feed" href="https://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 (https://www.ads-software.com/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?…
- The topic ‘Encoding ampersands from output of wp_head()’ is closed to new replies.