WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was using the javascript function convertEntities in a plugin that worked great until recently and now the function seems to have vanished under 3.3 - Is there a substitute function I should be using?

I am tempted to just copy the function into my script - is there a reason that is a bad idea?

share|improve this question
up vote 2 down vote accepted

convertEntities was removed because strings are passed to JavaScript via json_encode() now:


share|improve this answer
To clarify the above, all I had to do was remove the convertEntities function from my script and everything started working as before. Thanks!! The codex is now outdated here: codex.wordpress.org/Function_Reference/wp_localize_script , where at the bottom it says you need to use convertEntities to convert the object variable from string to HTML format. – Jeremy Ferguson Jan 9 '12 at 19:29
Quick update ^ WP Codex has been fixed and no longer refers to convertEntities. – Jeremy Ferguson Jun 10 '13 at 18:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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