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

Tim is a guy who does things. You can be successful if you do things too. He'll teach you.

View all posts

Who To Blame For Your Eventual Success

Tim Seidler

Tim is a guy who does things. You can be successful if you do things too. He'll teach you.

Free Website Critique?!

For a limited time Tim is accepting submissions from bloggers and website owners to get a free 5-minute video consultation with tips to improve monetization, user experience and pretty much anything else he can conjure up in that short of a time.

Sign Up Here

*Only one site per person, fulfilled as time permits.

The Ultimate Hack : How To Get Free (and Real) Business Plans From Profitable Websites In Your Niche

Enter your email address below and I'll send it your way.

People Talking About Me…

Want To Make Lots of Passive IncomeOnline?GetMy Top Hack...Free!

Want To Make Lots of Passive IncomeOnline?
GetMy 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.