WordPress.org

Ready to get started?Download WordPress

Forums

Auto Meta to All in One SEO Pack conversion? (3 posts)

  1. mishko
    Member
    Posted 6 years ago #

    I'm looking to migrate all my old posts that use Auto Meta plugin to use All in One SEO Pack instead. AiOSEO provides a more robust and elegant control over meta tags and title, and unlike AM it creates a valid feed.

    Has anybody found a quicker way to do this than cutting and pasting and changing the format in every single post?

    For Example:
    AM uses "keyword-one keyword-two"
    AiOSEO uses "keyword one, keyword two"

    I've got hundreds of posts and I shudder to think how long this would take to do by hand. Does anyone have, or could make a script to convert posts?

  2. mishko
    Member
    Posted 6 years ago #

    Well I seemed to solve this one on my own. It was a fairly simple process, in the end, of some Search and Replace queries to the database.

    I logged into phpMYAdmin to access our wordpress database and compared what a database looked like with AutoMeta installed to what a database looked like with All-in-One-SEO-Pack installed (I have multiple sites/blogs). To my surprise it was fairly similar. All the fields called "autometa" with AutoMeta installed were called "keywords" with AioSP installed. They both used the wp_postmeta table in the database, which was a good thing.

    Here are the Search and Replace queries I used:
    1)

    UPDATE wp_postmeta
    SET meta_key=(
    REPLACE (meta_key,
    'autometa',
    'keywords'));

    The above query searched the wp_postmeta table within the meta_key column for anything labeled autometa and changed it to keywords.

    Second I updated my titles (I used SEO Title Tag with AutoMeta, but AIOSP does both) that were named "title_tag" (because of SEO Title Tag) to just "title".
    2)

    UPDATE wp_postmeta
    SET meta_key=(
    REPLACE (meta_key,
    'title_tag',
    'title'));

    Again, this searched the wp_postmeta table within the meta_key column for everything labeled "title_tag" and renames it "title".

    So now the only thing left was to change the format of the values of these keyword fields. All my AutoMeta keywords were formatted as "keyword-one keyword-number-two keywordthree". Notice AutoMeta uses dashes to mean spaces between keywords and spaces to denote a new keyword. But All-in-one-SEO-Pack (AioSP) uses normal formatting like this "keyword one, keyword number two, keywordthree". So I had to do two queries to change all that and use a special WHERE command with the query.
    3)

    UPDATE wp_postmeta
    SET meta_value=(
    REPLACE (meta_value,
    ' ',
    ', '))
    WHERE meta_key='keywords';

    This searched the wp_postmeta table within the meta_value column for every " "(blank space) and replaced it with a ", "(comma space) with the special condition WHERE meaning only do this to the meta_value column if the corresponding (same row) meta_key column says "keywords".

    So now replace all dashes with a space in those same fields. You can see that this should be last because if you did it before #3 then it would create blank spaces to where #3 would replace with a comma space.
    4)

    UPDATE wp_postmeta
    SET meta_value=(
    REPLACE (meta_value,
    '-',
    ' '))
    WHERE meta_key='keywords';

    Again this searched the wp_postmeta table within the meta_value column and replaced all dashes "-" with a space " " but only WHERE the meta_key equals "keywords".

    This is from someone whose never done an SQL query, but looked it up online. Of course I made sure to backup my database first. :) Thankfully it was all successful.

    I hope this helps anyone else out there converting / migrating from the AutoMeta plugin to the superior All-in-one-SEO-Pack plugin.

  3. uberdose
    Member
    Posted 6 years ago #

    Since a few releases ago, All in One SEO pack can seamlessly include Auto Meta keywords, so you don't have to do any conversion, it just works.

Topic Closed

This topic has been closed to new replies.

About this Topic