Changing tags from underscores to dashes for SEO

The following tutorial covers the process of quickly and easily changing or converting your WordPress Tags from using an underscore _ to a dash - for search engine optimization. Google and other search engines do not recognize an underscore as a space. As a result, they will merge multiple keyword phrases into a singular word. Perhaps this not what you want for Search Engine Optimization (SEO) of your keyword tag phrases. To fix this we can use a dash which is a space recognizable character for search engine crawlers.

Note: If you have previously migrated from WordPress Ultimate Tag Warrior to the Simple Tags plugin, this tutorial is also for you.

Globally Replacing Tag Underscores with Dashes

  1. Login to your phpMyAdmin section from cPanel or equivalent
  2. Locate and select your WordPress database from the phpMyAdmin sidebar
  3. Click the SQL tab from the menu, insert the following lines and click go to apply the changes:

    update wp_terms set slug = replace(slug,'_','-');
    update wp_terms set name = replace(name,'_',' ');
    update wp_tags set tag = replace(tag,'_','-');

  4. If all goes well, your tags should have been converted from example_text_tag to example-text-tag
  5. Now you will need to add some information to your .htaccess file to redirect the old tag searches to the new tags. See Using .htaccess to redirect underscores to dashes.