The editor seems to change every ampersand (&) to &

is there any way to get rid of that function or something? I really need the only & to make my variables work.

  • what kinds of variables? Try putting & html editor.
    – Sisir
    Jun 23, 2012 at 7:50
  • I have a plugin so when I´m in the post editor I insert the shortcode with a "&" but in the URL output the "&" changes to & instead..
    – Freddos
    Jun 23, 2012 at 7:56
  • How are you using your variables?
    – aifrim
    Oct 1, 2014 at 6:09

3 Answers 3


I dont know what you are doing with your shortcode but it is good practice to serialize and parse data so that it displays beautifully.

Since you need to look for & and not for & just use $data = str_replace("&", "&", $data). Also you could look in the php manual for urldecode() and urlencode().

Read the note there:

Be careful about variables that may match HTML entities. Things like &amp, &copy and &pound are parsed by the browser and the actual entity is used instead of the desired variable name. This is an obvious hassle that the W3C has been telling people about for years. The reference is here: » http://www.w3.org/TR/html4/appendix/notes.html#h-B.2.2. PHP supports changing the argument separator to the W3C-suggested semi-colon through the arg_separator .ini directive. Unfortunately most user agents do not send form data in this semi-colon separated format. A more portable way around this is to use & instead of & as the separator. You don't need to change PHP's arg_separator for this. Leave it as &, but simply encode your URLs using htmlentities() or htmlspecialchars().

I hope this sheds some light onto your question.

  • 1
    This is the only solution work for me Jul 28, 2020 at 17:07

WordPress' default editor is escaping by default all html entities such as <, >, & and etc. You can check the Codex for more information. If you want your special characters to be printed as is, you can use the PHP function html_entity_decode() to decode the encoded entities:

function wpse_56268_decode_html_entities($content) {
    return html_entity_decode($content);

add_filter( 'the_content', 'wpse_56268_decode_html_entities' );

When a post is fetched it will decode the encoded characters and will print them in their original value. Although I don't recommend it.


&lt;strong&gt;Below we have a list&lt;/strong&gt;
    &lt;li&gt;List item 1&lt;/li&gt;
    &lt;li&gt;List item 2&lt;/li&gt;

Will be converted to this:

<strong>Below we have a list</strong>
    <li>List item 1</li>
    <li>List item 2</li>

This might be an obvious answer, but have you actually tried to save the post and view it and see if the shortcode works?

As far as I understand it, & is the correct way for & to display, no matter what its doing, otherwise the code would be invalid. The shortcode plugin should be coded to anticipate this, and work just fine.

What is the exact name of the shortcode plugin you are using?

  • It´s not a shortcode plugin itself. It´s a Uji Countdown plugin for Wordpress.
    – Freddos
    Jun 23, 2012 at 23:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.