HTML Entities displaying improperly as malformed escaped code

I’m having a strange issue that I’ve never seen before. I moved a WordPress site from Siteground over to GoDaddy a few days ago, and now the site appears to have problems displaying HTML entities in certain cases. For example, on the 404 page, the title prints to the source code as:

<h1 class=”page-title”>Oops! That page can&amp;rsquo;t be found.</h1>

Causing it to display on the page as “Oops! That page can’t be found.”

As you can see, for some reason the ampersand that is part of the HTML entity ‘ is being decoded first, breaking the actual HTML entity. This also seems to happen in my custom taxonomy’s terms, where it prints ampersands like &amp;amp; and even in the WordPress admin interface where it prints things like ← instead of the left facing arrow (←).

I tried editing the text in the taxonomy terms that were experiencing issues and the issue persisted. When I hit update again leaving the malformed &amp;amp; in place, it added three more amp;amp;amp;s to the end of the chain.

I looked in the PHP logs and found this little gem, over and over which I think is related:

PHP Warning: in_array() expects parameter 2 to be array, null given in …wp-includes/kses.php on line 1417

But it’s really not a very helpful or specific error.

Even stranger, the problems aren’t happening everywhere. When I made a new post and put some HTML entities into the content, they displayed the proper characters as expected.

Has anyone seen something like this before? Most of my searches have just brought up examples of it happening on sites with PHP error display turned on. The stuff I’ve run across seems to suggest that it could be an issue with the encoding, but I don’t really know. I don’t think it’s a problem with the theme or any of the plugins, because this problem isn’t happening on the site at all on the Siteground server which has the exact same code and database.

Any suggestions towards fixing this issue or at least troubleshooting it would be much appreciated. Thanks!

Read more here:: HTML Entities displaying improperly as malformed escaped code

Leave a Reply

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