I have some text stored in a string $text
that’s filtered through the_content
and therefore, wptexturize().
wptexturize() is a function that replaces various characters into more prettier ones.
Is there any way that I can unwptexturize() the string? Revert it back to what it was.
What I’ve danced with so far
I can replace smart quotes with regular ones like this:
$text = iconv('UTF-8', 'ASCII//TRANSLIT', $text);
But that will only cover the smart quotes, there are a lot more characters.
Another alternative is to write a custom regex to replace all these characters back to their original ones.