Title: Mysql query to insert &quot;EXPIRED&quot; into titles
Last modified: September 1, 2016

---

# Mysql query to insert "EXPIRED" into titles

 *  Resolved [eatdrinkdeals](https://wordpress.org/support/users/eatdrinkdeals/)
 * (@eatdrinkdeals)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/mysql-query-to-insert-expired-into-titles/)
 * On my WordPress site I have several thousand posts about deals that have expired.
   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 these post titles.
   This would be for all posts in the Archived category regardless of date. I would
   appreciate suggestions.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Max](https://wordpress.org/support/users/clementsm/)
 * (@clementsm)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/mysql-query-to-insert-expired-into-titles/#post-7577840)
 * Unless I am miss-understanding you here – it sounds like the posts that have 
   expired are all in the “Archived” category. Therefore, would it not be simpler
   to just check if the post is in the archived category in the loop – and then 
   print the word “Expired” if it is – in the appropriate place in your template?
 * Sounds like the [in_category()](https://developer.wordpress.org/reference/functions/in_category/)
   function may be what you are looking for – and some code, similar to the below?
 * `if ( in_category( "Archived") ): echo "Expired"; endif;`
 *  Thread Starter [eatdrinkdeals](https://wordpress.org/support/users/eatdrinkdeals/)
 * (@eatdrinkdeals)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/mysql-query-to-insert-expired-into-titles/#post-7577877)
 * Thanks, Max, that looks like a better solution to the one I used. I did run a
   query to insert “expired” into my titles but it changed all of them. I manually
   fixed the non-archived posts so I’m done now.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Mysql query to insert "EXPIRED" into titles’ is closed to new replies.

## Tags

 * [expired](https://wordpress.org/support/topic-tag/expired/)
 * [MySQL](https://wordpress.org/support/topic-tag/mysql/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [eatdrinkdeals](https://wordpress.org/support/users/eatdrinkdeals/)
 * Last activity: [9 years, 9 months ago](https://wordpress.org/support/topic/mysql-query-to-insert-expired-into-titles/#post-7577877)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
