In a recent post, I talked about using the WordPress plugin Add Meta Tags for adding meta descriptions and titles to posts and pages within my WordPress sites. It’s a simple SEO tool but works well. Nevertheless, I decided to switch my sites over to Yoast SEO for all its extra features and guidance in constructing pages. I was anticipating quite a job as this blog alone has almost 100 posts and all of those descriptions needed to be transferred from the fields created by the old plugin to Yoast’s fields. Yoast does have some import tools of its own but they didn’t include the one I’d been using and my experience with a third-party converter had not been good so I was glad to find that I could do it so simply with one query in phpMyAdmin.
The meta descriptions generated by both the Add Meta Data and Yoast plugins are stored in the wp_postmeta table in the WordPress database. This table stores key / value pairs for information related to the individual items with the post_id field identifying the specific post or page and the meta_id field acting as a table key. Yoast stores it’s meta descriptions under the key “_yoast_wpseo_metadesc” and Add Meta Data stored its descriptions as “_amt_description”. I was able to verify this by looking for the values in the few posts that I had manually converted.
A single SQL query was able to change all the description records for the previous plugin to use Yoast’s key title.
UPDATE <database name>.wp_postmeta SET meta_key = '_yoast_wpseo_metadesc' WHERE meta_key = '_amt_description'
Yoast does have a setting to use meta keywords but I’m not using them this time around so the description was really the only thing to be moved over. Yoast had automatically converted the titles from the Post titles. Within an hour I had converted both sites and removed the old plugin completely while retaining all of my meta descriptions.
You should be familiar with either phpMyAdmin or MySQL Workbench before doing this and you should understand the basics of SQL. If you do decide to try this BE SURE TO BACKUP YOUR SITE FIRST and double-check your SQL queries before running them. Even though I’d done a recent backup, I paused a second or two before clicking the Go button.