WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a site where posts get created and expired often. I want to add 410 status code to all posts that expire so that Search Engines remove them.

I want to know if wordpress provides a provision to do this? or is this possible at all? Any suggestions how to achieve this would be very helpful.


share|improve this question
What do you call expired posts? – sorich87 Oct 22 '10 at 6:45
expired posts are nothing but posts status changed to draft. I don't want google to crawl them any longer hence I want to make them as 410. – Harsha Oct 22 '10 at 6:58
up vote 1 down vote accepted

Just did some testing and seems there is a bug here.

Newly created draft posts are not accessible on front-end. Search bot (or anyone else not logged in and using special preview URL) gets 404 error on them.

But if you publish and change back to draft then post remains available by direct link (does get removed from index).

For this reason I would stay away from using draft for this purpose. I would try to use custom field to mark post as expired and filter the_content to show informational message and set headers with status_header() function.

share|improve this answer
Thanks for the function Rarst. My posts are already indexed, so I have to remove them. There is one more issue here, I am able to set the header to 410, however, I want wordpress to show 410.php page when requests is made for these url's. I have created 410 page, but still that page is not being displayed. How do I make that 410 page appear for these url's? – Harsha Oct 22 '10 at 9:50
You mean 410 page as error page in your hosting settings or in WP? Such hosting functionality mostly gets overridden with WP. Sorry, I have no idea how to handle this perfectly... Especially because of seemingly bugged draft mechanics. – Rarst Oct 22 '10 at 9:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.