Once a year I have an issue I run into that needs an elegant solution. I need to take every instance of the keyword 2014 (or whatever the current year is) in my page content, SEO meta tag titles and descriptions and switch it over to the new year.

Once a year I have an issue I run into that needs an elegant solution. I need to take every instance of the keyword 2014 (or whatever the current year is) in my page content, SEO meta tag titles and descriptions and switch it over to the new year.

The first year I did this I manually went through each page and title and painstakingly changed them. Since then I’ve obtained quite a few more pages to manage and my yearly routine is much faster.

For those of you brave enough to wander into your mySQL database and make some permanent changes this solution will find and replace anything you want really quickly.

*Be aware that any changes you make in this way could break your site if you’re not careful so be sure to back up your database first.

What to do

Navigate to your mySQL database. For me this is a PHP myAdmin control panel that I find through my Plesk control panel in my MediaTemple hosting account.

Once you’re in click on wp_posts under your database tables on the left. After that click the SQL tab that runs along the top. Then delete the pre-written query that’s in there and replace it with this.

UPDATE wp_posts SET post_content = REPLACE (
post_content,
' 2014',
' 2015');

Essentially you’re telling the database to look in the table wp_posts for the column post_content and replace anything in that column that matches space 2014 with space 2015. The space is important because if you don’t include that it will break all of your images that are stored in that column that were uploaded in that year (ie http://www.getnichequick.com/wp-content/uploads/2014/10/theseidlers.jpg). The space essentially make it look for natural content.

I’ll run this query twice. Once with the space in front and once with it in the back in case there was a period or other character butted up against either end.

To do the same for All-In-One SEO meta title and meta description tags I’ll query a different table.

This time I go to wp_postmeta where AIOSEO stores its data and run run the query in the meta_value column.

UPDATE wp_postmeta SET meta_value = REPLACE (
meta_value,
' 2014',
' 2015');

The Results

What you get in the end is every page on your site containing the keyword 2014 being instantly converted and relevant to the new year of 2015. I’ve messed with plugins that supposedly run database queries like this before, but have never had luck. This is the only way I’ve been able to accomplish mass find and replaces like this.

Hope it helps someone else out there. Let me know if it works for you in the comments below.

Help Me Help You

Help Me Help You

If you're looking to build, buy or sell I want to know you. You might not know you need assistance right now, but after we talk I bet you'll feel differently. Drop your email address below and I'll personally reach out to see how I can help.

You have Successfully Subscribed!

Tim Seidler

See how Tim wrote some stuff up there? You should do that too. Tim's mission is to take average people, force them to write about stuff they know, and then help make them successful beyond their wildest dreams. Easy peasy.

View all posts

What? A Real Person?!

Hello. I'm Tim. And I'm a real person.

Tim Seidler

I'm currently doing, done, or intending to do all the things I talk about on GNQ.

If you're lost, need help or want to talk to a real person about internet marketing I'm always up for a chat.

Reach Me Here

Websites For Sale

Sincere thanks for signing up. We'll email you new listings the moment they're offered for sale.

Want To Make Lots of Passive Income Online?Get My Top Hack...Free!

Want To Make Lots of Passive Income Online?
Get My Top Hack...Free!

All you need to do is...

You're In! We'll send you a welcome email with the link to the hack, but if you want faster access just click here.