• Resolved eatdrinkdeals

    (@eatdrinkdeals)


    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

    (@clementsm)

    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() 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

    (@eatdrinkdeals)

    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.