Title: Plugin: Auto Delete Posts
Last modified: August 18, 2016

---

# Plugin: Auto Delete Posts

 *  [Cypher](https://wordpress.org/support/users/cypher/)
 * (@cypher)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/plugin-auto-delete-posts/)
 * A plugin to automatically delete all posts beyond an expiration date. This is
   the first release, will continue working on a few things I’ve already planned
   for it.
 * Grab your copy [here](http://ashwinbihari.com/archives/2005/07/13/plugin-auto-delete-posts/).
 * Comments always welcome either here or at my [website](http://ashwinbihari.com/contact-me).
 * Regards

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

 *  [hooopla](https://wordpress.org/support/users/hooopla/)
 * (@hooopla)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/plugin-auto-delete-posts/#post-234564)
 * Hi Cypher…
 * I wanted to clarify the behaviour of this plugin. I’m hoping to autodelete posts
   older than 24 hours old. Is that possible?
 * I _think_ that if I set it to 1 day, then it will delete anything dated the previous
   day — for instance at midnight, when the date advances, it would delete something
   posted at 23:00 the day before. Is that correct?
 * If it is correct, would it be possible to add the ability to delete based upon
   age expressed in hours?
 * Thanks.
 * M.
 *  [hooopla](https://wordpress.org/support/users/hooopla/)
 * (@hooopla)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/plugin-auto-delete-posts/#post-234568)
 * Sorry, one more question. When I preview posts to be deleted, I notice that it’s
   also including WP static “pages” that were created in the selected date range.
   Will it actually delete those pages?
 *  [hooopla](https://wordpress.org/support/users/hooopla/)
 * (@hooopla)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/plugin-auto-delete-posts/#post-234569)
 * _I think that if I set it to 1 day, then it will delete anything dated the previous
   day — for instance at midnight, when the date advances, it would delete something
   posted at 23:00 the day before. Is that correct?_
 * I’ve been playing with this and starting to understanding how it works.
 * It does seem to be using hours (rather than simply looking at the date). So that’s
   good!
 * Where I’m still confused is that I have WP set to GMT -7 hours. If I edit an 
   existing post so that its timestamp is, say, 24 hours ago, it shows up in the
   preview as something that will be deleted. If I edit the timestamp to 20 hours
   ago — same thing. Only when I edit it to 17 hours ago (i.e., 24**-7**) does it
   escape deletion.
 * It’s possible I’m misreading things here. (I’ve been trying to wrap my head around
   time offsets all afternoon and my brain hurts.) But right now, my hunch is that“
   1 day” to the plugin = 1 day + offset entered in Options > General. Is that true?
 *  [hooopla](https://wordpress.org/support/users/hooopla/)
 * (@hooopla)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/plugin-auto-delete-posts/#post-234570)
 * _Sorry, one more question. When I preview posts to be deleted, I notice that 
   it’s also including WP static “pages” that were created in the selected date 
   range. Will it actually delete those pages?_
 * Ouch! Yes, those page links are gone. No data is lost, but the static pages have
   to be relinked in Manage > Pages.
 *  [Lorelle](https://wordpress.org/support/users/lorelle/)
 * (@lorelle)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/plugin-auto-delete-posts/#post-234571)
 * If you would like information from the plugin author, we recommend you visit 
   the author’s website, posted above, to comment and discuss the plugin and get
   specific help for the plugin.
 * Not all plugin authors check the Forum on a regular basis, and some may not see
   your posts.
 *  [hooopla](https://wordpress.org/support/users/hooopla/)
 * (@hooopla)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/plugin-auto-delete-posts/#post-234572)
 * Thanks, I’ve posted on his site and asked him to drop by when he gets a chance.
   This is a really useful plugin and I’m hoping other people might have thoughts
   to add.
 *  Thread Starter [Cypher](https://wordpress.org/support/users/cypher/)
 * (@cypher)
 * [20 years, 9 months ago](https://wordpress.org/support/topic/plugin-auto-delete-posts/#post-234619)
 * Sorry for my late arrival. I was out of the country for the latter part of July
   and couldn’t check on the website. But I’m back now and will get back to working
   on this plugin to fix the issues mentioned here. 🙂
 * Regards
 *  [hooopla](https://wordpress.org/support/users/hooopla/)
 * (@hooopla)
 * [20 years, 9 months ago](https://wordpress.org/support/topic/plugin-auto-delete-posts/#post-234620)
 * I’ve been using the Auto Delete Posts plugin on my site with the change suggested
   by Kafkaesqui and it works very well (no more deleting of static pages). I also
   figured out the confusion about ‘1 day+ GMT offset’. In the end, it was due to
   moving my site to a new host and not realizing that time() was returning a different
   value.
 * After a couple of weeks in use, I have only one more suggestion for improvement.
   The “trigger” for auto-deletion is when adding or editing a post. I’m wondering
   whether there’s a low-overhead way of making timestamp the trigger — i.e., every
   time a post’s timestamp is reached and the post becomes visible to visitors, 
   the auto delete query would run.
 * The reason I’m asking is that I post about 50 times a day, but when I’m not updating(
   sleeping!) the posts scheduled for auto deletion stay on the site until my next
   update. Ideally, I’d like them to simply be deleted after exactly 24 hours — 
   whenever that occurs — and not 24 hours + however much time elapses before I 
   do the next update.
 * Cheers.
 *  Thread Starter [Cypher](https://wordpress.org/support/users/cypher/)
 * (@cypher)
 * [20 years, 9 months ago](https://wordpress.org/support/topic/plugin-auto-delete-posts/#post-234623)
 * Hoopla,
 * Thanks for the feedback about the changes suggested. I will make that change “
   officially” and release it. 🙂
 * As far as the trigger goes, that was one of the things I spent some time thinking
   about. In most cases I found that people usually set the deletion duration to
   be in the order of weeks, not necessarily 24 hours and so using the POST and 
   EDIT actions worked well as long as they posted something in a couple of weeks.
 * In your case, requiring hard 24 hour trigger would mean that something like a
   CRON job would be necessary. I will look into this and get back to you.
 * Regards
 *  [hooopla](https://wordpress.org/support/users/hooopla/)
 * (@hooopla)
 * [20 years, 9 months ago](https://wordpress.org/support/topic/plugin-auto-delete-posts/#post-234624)
 * Many thanks, Cypher. I realize my requirements are a bit unusual and appreciate
   you considering them.
 *  [hooopla](https://wordpress.org/support/users/hooopla/)
 * (@hooopla)
 * [20 years, 9 months ago](https://wordpress.org/support/topic/plugin-auto-delete-posts/#post-234625)
 * One other thought. I’m not proficient at PHP and MySQL, so perhaps this is not
   a good suggestion. But I’m thinking that the trigger could simply be the action
   of viewing the page (i.e., each time the page gets loaded, the auto delete function
   runs against anything older than X). I’m not sure whether that would be very 
   efficient, but it might achieve the same effect without the need for a cron job.
 * Cheers.
 *  Thread Starter [Cypher](https://wordpress.org/support/users/cypher/)
 * (@cypher)
 * [20 years, 9 months ago](https://wordpress.org/support/topic/plugin-auto-delete-posts/#post-234628)
 * It is definitely possible to hook into the display of a page to trigger the plugin
   to check for post deletion, the only issue with this as you’ve already noted 
   would be the efficiency.
 * It would be quite strenous for the system to have to execute a SQL query to check
   for posts to be deleted (and actually delete them) every time a page is viewed.
   If you have a popular website, this would add many unnecessary queries and slow
   things down.
 * However, if you are on a dedicated machine and don’t mind the overhead, it is
   certainly something I can give you an option to enable. 🙂
 * Regards
 *  [hooopla](https://wordpress.org/support/users/hooopla/)
 * (@hooopla)
 * [20 years, 9 months ago](https://wordpress.org/support/topic/plugin-auto-delete-posts/#post-234629)
 * Heh. I think you answered _that_ question! No, I’m not on a dedicated machine.
   😉
 *  [tchamberlain](https://wordpress.org/support/users/tchamberlain/)
 * (@tchamberlain)
 * [19 years, 9 months ago](https://wordpress.org/support/topic/plugin-auto-delete-posts/#post-234712)
 * This site appears to be offline that conatins this plugin. Can any one please
   provide the plugin. Its something I really need due to the fact I get 100’s of
   post a dya and would like to delete anything over 30 days.
 * Thanks!

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

The topic ‘Plugin: Auto Delete Posts’ is closed to new replies.

 * 14 replies
 * 4 participants
 * Last reply from: [tchamberlain](https://wordpress.org/support/users/tchamberlain/)
 * Last activity: [19 years, 9 months ago](https://wordpress.org/support/topic/plugin-auto-delete-posts/#post-234712)
 * Status: not a support question

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
