HTML tags in bloginfo description
-
15-04-2021 - |
Question
I'm trying to set some <span>
tags in the bloginfo description. So I put this in the blog description field:
<span class="name">Archive | Navarro Vives</span> <span>is a point of reference</span> <span>for those who wish to</span> <span>find out more about the life and work of Josep Navarro Vives.</span>
bloginfo('description')
returns this string:
<span class="name">Archive | Navarro Vives</span> <span>is a point of reference</span> <span>for those who wish to</span> <span>find out more about the life and work of Josep Navarro Vives.</span>
And it is printed in the browser as <span class="name">Archive | Navarro...etc
(with escaped tags).
I tried to:
$description = bloginfo('description');
echo html_entity_decode($description);
but it returns exactly the same as bloginfo('description').
How can I unescape these <span>
tags?
Solution
I found the answer. just replace
bloginfo('description')
by get_bloginfo('description')
So
echo html_entity_decode(get_bloginfo('description'))
Works as expected.
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange