josh_pollock
Veteran
Just Getting Started
Member Likes (0)
I'm building a site that is using autoblog to generate posts from various feeds. I have set it so that all of the posts will be created as pending, so my client can choose which ones he want to end up on the site.
This is going to create a ton of pending posts that will never get used. Is there a way to make it so that pending posts older then a certain number of days it will automatically be deleted?
I figure it would be a function that worked something like this:
If: post is > X days old
When: post status= pending
Then: move post to trash

Responses (2)
Member (joined March 2012) Likes (0)
I don’t see this option, but give this a try, in the dashboard choose setting>> Discussion>> other comment settings>> automatically close comments. Set it for 1 day>> post a comment and see if it deletes it in 24hrs. This is not what it’s for but it’s the best chance I see. Maybe by then a more experienced member will address this for you.
Support Chimp (joined March 2010) Likes (0)
Hey there.
I think the easiest way (if there is not a suitable plugin) would be to create a custom PHP file and then stick in a MySQL statement which remove everything in the table that is pending and older than X days.
PHP will handle the date calculation for you.
Then set up a server cron to run the specified file at set intervals throughout the day, week or month.
If there is a lot then you will want to do this incrementally so that your site doesn't slow down and stop responding.
Here are some other plugins:
http://wordpress.org/extend/plugins/wp-mass-delete/
http://wordpress.org/extend/plugins/bulk-delete/
http://wordpress.org/extend/plugins/wp-optimize/ - I'm sure last time I checked this wasn't multisite compatible, but worth checking again.
Some handy articles and snippets:
http://wpmu.org/8-tips-for-keeping-a-squeaky-clean-wordpress-database/
http://wpmu.org/11-ways-to-make-your-wordpress-site-faster-and-leaner/
Hopefully this will help. :)
Take care.
Become a member