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.
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.
You must be logged in to post a comment.
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 forurldecode()
andurlencode()
.Read the note there:
I hope this sheds some light onto your question.
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: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.
This:
Will be converted to this:
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?