Removing Special Characters from Your WordPress Site

by Lex on October 10, 2022

Removing Special Characters from Your WordPress Site

Guest Post by Sex Coach Lex

Hello my fellow professional sex geeks!

So you’ve just updated or migrated your website, which seems like a pretty routine thing to do, but suddenly you have weird characters all over your site. Ah!!! 

LORT GIF of a hobbits saying, "I didn't think it would end this way" to Gandalf

Don’t worry. The same thing happened here. Thousands of special characters were sprinkled on almost every single article and page on the website. It wasn’t pretty. But with a little bit of time and the right plug in, I was able to clean it up easily. (Seriously. This might seem like a lot, but it took longer to write this article than to actually implement the changes.)

Still not sure what I’m referring to? These are the characters in question:

“, ‘, â€, ’, —, –, •, …, Â

No, they’re not Moon Runes, Nerd… (Hat tip to The Lord of the Rings!)

Lord Of The Rings GIF of the moonlight map revealing secret language characters
Watch the movie clip HERE.

These special characters can appear after a website migration, theme update, website update, or database restore. As far as I know, this problem only affects older websites, but in case it happens again in the future, Reid wanted me to make sure you had a place to go for a fix. 

There are a couple of ways to address this problem. Some of them involve diving into the PHP or the database inserting lines of code or running a query. We won’t be messing around in there. If you’re reading this article, I’m assuming you aren’t someone well versed in writing website code.  If I’m wrong, skip to the bottom of this article.

To sum things up, for whatever reason, several characters have been replaced all over your site with various special characters, and one character that seems to be sprinkled in just for fun ¯\_(ツ)_/¯. Below you can find each of the characters involved and the correct character that should be in its place. In order to fix this we will be using a plugin called Better Search Replace by Delicious Brains.

Better Search Replace will search through your databases for one string of characters and replace it with another. With that in mind please back up your site before moving forward. Whenever you do anything that can impact your database you should make sure to have a backup. In fact, if you aren’t already backing up your website regularly, you should go and do that now. There are plenty of plugins that will do it for free like JetPack and UpDraft. Go ahead. I’ll wait…

Done backing up your website? Great. 

After downloading and activating the Better Search and Replace plugin, you can find it under the Tools menu. It should look something like this:

One of my favorite features of this plugin is ​​its ability to run a test find-and-replace operation on your entire WordPress database to see how many fields (if any) will need to be updated. You do this by making sure the “Run as dry run?” checkbox is checked before clicking “Run Search/Replace.” I highly recommend doing a dry run before every replacement.

Using the plugin is pretty straightforward. In the box labeled Search for you will enter the character you want to remove. In the box labeled Replace with you will put the characters you will want to take the place of those that you are removing. (This can also be used to change url links in the database, which is the original function of this app). Here’s the one tricky part. You have to know which databases to search in. You don’t need to search them all, just those that affect the text that people see. These are the databases related to posts and comments. The databases are titled like this “[wordpress username]_[database name]. So the databases that you want to select will look something like this:

  • username_commentmeta
  • username_comments
  • username_postmeta
  • username_posts

Feel free to email me if you have trouble finding the correct databases to switch out. 

To select all four you will need to click on the first one then for the following three hold command (for mac) or control (for windows) and click on them. This should allow you to select all four. Once you have verified that all four are highlighted, you just need to hit “Run Search/Replace.”

Now that you have the general idea of how to remove the characters, let’s look at what we will be removing.

Special CharacterCorrect Character NameCorrect Character
‘Left (opening) single quote
’Right (closing) single quote
—En dash (short dash)
–Em dash (long dash)
•Hyphen
…Ellipsis
“Left (opening) double quote
”Right (closing) double quote
ÂBlankBlank

I’ll take you step by step through exactly how I did it, including optional but highly recommended steps. 

  1. In the chart above copy the character from the Special Characters column.
  2. Optional: Open your website in a separate tab, go to the website’s search bar and paste that Special Character in the search bar so you can see all the places it appears in. 
  3. Open the Better Search and Replace tool in your wordpress dashboard.
  4. Paste the Special Character you copied from the chart above into the Search for box.
  5. In the chart above copy the corresponding correct character from the Correct Character column. (Example: If the special character you copied was ‘…’ the corresponding character is ‘…’)
  6. Select all four databases mentioned above.
  7. Only have the Run as dry run? checkbox checked.
  8. Click on Run Search/Replace.
  9. Wait for results.
  10. Optional: Marvel at how big of a mess was made of your website.
  11. Uncheck the Run as dry run? checkbox.
  12. Wait for results.
  13. Optional: Switch back to the tab with your website. Click the search button again. This should now return zero results. 
  14. Repeat this procedure with all 9 of the symbols listed above. 

Important Note: I arranged the order of these symbols in the order they should be replaced. As you may have noticed the characters ‘‒ appear in all of the characters above it as well. It is actually supposed to be ‘†’ – with a space after. If you do it earlier in the sequence and don’t include the space it will end up replacing all the characters above it, but only partially. You don’t want that, because you may have to go back and restore your whole site if that happens. By replacing the ‘‒ symbol second to last or last, you avoid any potential problems. 

The symbol ‘Â’ appears to just be a filler. When replacing this symbol leave the Replace with box empty. Since it is actually a blank, your search bar may not return any results when you try to search for it, even though your dry run will so results for it. However, this is probably the most prevalent symbol, so you can just find one page you’ve already seen it on, if you want to watch it disappear. 

Lord Of The Rings GIF of the Ring melting in the volcanic magma
Lord Of The Rings GIF of Frodo saying "It's done."

And that’s all folks. Your website should now be completely free of the scourge of cryptic symbols!

P.S. If you regularly use characters outside of the English alphabet, then you might find more symbols. For example, while writing this very article I found another weird symbol ‘é’ all over Reid’s site. It was in the place of the ‘é’ character, which many people use in their name.

Leave a Comment

Previous post:

Next post: