0
votes

On my Wordpress site I have several thousand posts of expired deals. They are all in the Archived category. I am looking for a Mysql query or php program that will insert the string "EXPIRED" in front of all their titles (Archived posts). I would appreciate suggestions.
PS - There are plugins that would do this but they all require that I edit each post to set an expiration date, and I have thousands of posts.

1

1 Answers

0
votes
UPDATE yourtable 
SET titleColumn = CONCAT('EXPIRED ', titleColumn) 
WHERE category = 'archived'

You have to adjust the tablename, columnnames and the where clause.

Don't forget to backup your data before changing values from outside of your program.

Fiddle before update: http://sqlfiddle.com/#!9/74462a/3

Fiddle after update: http://sqlfiddle.com/#!9/b27752/2