During my last redesign and site overhaul, I finally made the leap from WP 2.0 to 2.3. In the process of synchronizing data and removing unecessary plugins, I managed to replace several keyword- and meta-related plugins with the incredible All in One SEO Pack (AiOSEO). One of the plugins replaced by AiOSEO is Autometa, an otherwise very useful meta-keywords management tool.
Over the course of a year or so, Autometa had accumulated a significant number of meta keywords in its associated database table. Thus, to keep these keywords, I needed an effective way of transfering them from Autometa to AiOSEO. I definitely wanted to avoid having to manually re-enter the data.. — perhaps a direct database migration?
Fortunately, I am not the first person to blaze this trail, as I gladly discovered an excellent thread in the WordPress forums that provided the perfect solution. After successfully transferring my Autometa data into AiOSEO, I decided to share the technique in “official” tutorial format ;)
Step 0: Backup Data
Just a friendly neighborhood reminder to backup your data(base) before attempting any modification. ;)
Step 1: The Transfer
Log into phpMyAdmin and locate the WordPress database for your site. Next, open the “SQL” screen and enter the following search-and-replace query:
UPDATE wp_postmeta SET meta_key=( REPLACE (meta_key, 'autometa', 'keywords'));
Upon execution, this database query renames all “
autometa” fields to “
keywords”. Both plugins use the same table,
wp_postmeta, however, Autometa assigns its keyword data to the
autometa field, while AiOSEO assigns its keyword data to the
keywords field. Thus, by renaming all instances of “
autometa” to “
keywords”, we are effectively transferring our Autometa keywords to AiOSEO.
Step 2: Reformatting the Data
Now we are going to reformat the reassigned Autometa keywords for AiOSEO. Return to the “SQL” screen and enter this query:
UPDATE wp_postmeta SET meta_value=( REPLACE (meta_value, ' ', ', ')) WHERE meta_key='keywords';
Upon execution, this query searches the
meta_value column within the same table and replaces every blank space (
" ") with a comma space (
", ") for any entry with an associated “
keywords” value in the “
meta_key” column. Basically, we are ensuring that our recently transferred Autometa keywords are recognized as individual keywords when processed via AiOSEO.
Finally, to complete the data reformat, return to the “SQL” screen and enter this query:
UPDATE wp_postmeta SET meta_value=( REPLACE (meta_value, '-', ' ')) WHERE meta_key='keywords';
Here, we have completed the reformatting by replacing all dashes (
"-") with spaces (
" ") for any
meta_value field with an associated “
keywords” value in the “
meta_key” column. This is important because Autometa uses dashes to denote spaces in keywords, whereas AiOSEO simply uses spaces. Thus, the net effect of the previous two queries ensures that your keywords look like this:
- keyword two
- keyword three
- another fine keyword
..instead of this:
Again, this is the method that I used to convert my existing Autometa keyword data into AiOSEO. The migration went very smoothly, and required no special modifications to anything before, during, or after the conversion process. Of course, if you are using a newer version of AiOSEO, you may not need to do anything, as the plugin supposedly automates the transfer process; however, this feature would not work for me, for whatever reason. In any case, for those that need it, this import/export method for Autometa/AiOSEO works great — just remember to to backup your data ;)
Shouts out: HUGE shouts out to mishko for taking the time to share this trick with the fellow WordPress peeps!