wordpress 2.3 HTML entity bug

There is/was a rather annoying bug in wordpress 2.3. Normally when editing pages in the advanced editor, the actual text of the post/page has to be preprocessed to convert things like × to × so that it wouldn't show up in the editor as ×, and ditto for angle brackets. The extra ampersands and brackets would then be removed before saving. However, in the 2.3 upgrade a few things in the core structure of post/page retrieval had been changed and the somehow the the page-retrieval didn't do the pre-processing anymore. The upshot was that the amps and brackets got converted to normal ascii and unicode, seriouslycompletely messing up your pages.

I managed to track the problem to get_post() and get_page() in wp-includes/post.php. get_post() did get the upgrade, but get_page() didn't. The latter needs to be updated to carry and use a third parameter, and call sanitize_post() like get_post() does.

Of course, right after doing this I found out that a fix was already present in the SVN. Just update the file with this one. Ain't that always the way.


To see if you are affected as well, make a new page and input the following:

× > entities

Then hit `Save and Continue Editing'. If the text has changed to “× > entities”, you're in trouble: every page you edit in that state will have its entities converted. Get the fixed file as soon as possible.

Leave a Reply

Your email address will not be published. Required fields are marked *