WordPress.org

Ready to get started?Download WordPress

Forums

Plugin: Auto Delete Posts (15 posts)

  1. Cypher
    Member
    Posted 9 years ago #

    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.

    Comments always welcome either here or at my website.

    Regards

  2. hooopla
    Member
    Posted 9 years ago #

    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.

  3. hooopla
    Member
    Posted 9 years ago #

    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?

  4. hooopla
    Member
    Posted 9 years ago #

    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?

  5. hooopla
    Member
    Posted 9 years ago #

    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.

  6. Lorelle
    Member
    Posted 9 years ago #

    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.

  7. hooopla
    Member
    Posted 9 years ago #

    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.

  8. Cypher
    Member
    Posted 9 years ago #

    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

  9. hooopla
    Member
    Posted 9 years ago #

    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.

  10. Cypher
    Member
    Posted 9 years ago #

    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

  11. hooopla
    Member
    Posted 9 years ago #

    Many thanks, Cypher. I realize my requirements are a bit unusual and appreciate you considering them.

  12. hooopla
    Member
    Posted 9 years ago #

    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.

  13. Cypher
    Member
    Posted 9 years ago #

    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

  14. hooopla
    Member
    Posted 9 years ago #

    Heh. I think you answered that question! No, I'm not on a dedicated machine. ;-)

  15. tchamberlain
    Member
    Posted 8 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.