AppThemes

Quick Update + Handy mySQL Query Code

Over the last few months it’s appeared rather quiet here at ClassiPress HQ. In actuality, we’ve been quite busy behind the scenes working on a new update (v3.0.3) and a brand new company web site. We plan on launching the new site early next month (which we’ll announce in a separate post and email to all customers) and then the 3.0.3 update will be released soon thereafter. It’s a bug fix and feature enhancement release so nothing major.

Anyhow, the reason for this post was to provide a handy bit of mySQL code when migrating your ClassiPress site to another domain.

While going through the demo site migration process, we had to change a bunch of legacy meta_values which have the image urls hardcoded in them so the thumbnail and ad images weren’t showing up. Instead of manually having to go through hundreds of records, it made more sense to write a custom sql query to handle the same change in a matter of seconds.

I wanted to share this just in case any of you plan on migrating one of your web sites to a different domain. Keep in mind, this sql query would only be necessary if you were previously using version 2.9.3 or earlier since 3.0+ doesn’t rely on the “images” meta field.

So you’ll need to login to your mySQL admin and go to your SQL tab. There you’ll want to paste in the following code (replace the oldsite.com and newsite.com of course first). You might even want to do a test run on one record first just to be safe.

UPDATE wp_postmeta
SET meta_value = replace(meta_value, 'oldsite.com', 'newsite.com')
WHERE meta_key = 'images'

After you run this query, all your oldsite.com’s will be replaced with your newsite.com’s!

Your rating: none
Rating: 5 - 1 vote