Adds an expiry date and time to posts, pages, or custom post types in which the post becomes a draft.
- Supports custom post types
- Allows admin to choose which post types can expire
- Sets expired posts to drafts rather than deleting them
- To show an expiry date on the frontend, use shortcode [expirydate] else function es_ape_exp_date()
electric-studio-auto-post-expirefolder to the
- Activate the plugin through the ‘Plugins’ menu in WordPress
- How does it work?
The plugin uses WordPress’s built-in cron functionality. Every set time it will check whether there’s anything to expire. Previously it checked on pageload, which was resource-intensive on high-traffic websites. You can check when it’s going to run next on the top of this page.
- When will it run first?
As soon as you hit the “Save Changes” button. If it’s at 2am, then 2am, and then x interval you set.
If you want to reset the time (say, you want to run it every day at 4am), you need to set the frequence to something else, and then back to daily at 4am. Future release of the plugin may have a “run first at” option, but not just yet.
- How do I disable the default expiration time?
Click on the input field (color will change red if you move your mouse over it) and Save Changes
- How often should I run the check?
That depends on the traffic your site is getting, and the granularity you want to achieve.
If you need to expire a piece of content at 15:34, then I suggest setting 15 minutes and clicking Save Changes at any of these times past the hour: 4, 19, 34, 49 minutes.
If you have a very high-traffic site with a lot of content, then I suggest running it daily at the wee hours of the morning (or when you have the least ammount of traffic. Check your analytics).
It will run a complete loop of every post type, so it might take a while, and eat up server memory and CPU cycles for a bit, which means for a short time your site will be slower.
- It says the next scheduled check runs in a negative amount of minutes. What gives?
That’s just cron and WordPress being silly. Refresh should solve that problem, but basically, WordPress thinks the next schedule is still in the past. It will get there, don’t worry.
That’s all I can think of right now. If you have any other questions, post them here, or the plugins WordPress plugin page. Use latter for bugs, and this one for general questions / feature requests though.
- Can I use this plugin on more than one post type?
Yes you can since version 1.2
- Can I show the expiry date on the front end of my site?
Yes, since version 1.3.5, I have included the shorted code of [expirydate format=”d-m-Y”] or for those that would like to build it into their template, you can use
es_ape_exp_date( $format ). ($format is optional, and is the same as the PHP date formats (see http://uk.php.net/manual/en/function.date.php))
There are no reviews for this plugin.
Contributors and Developers
“Electric Studio Auto Post Expire” is open source software. The following people have contributed to this plugin.Contributors
Translate “Electric Studio Auto Post Expire” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
- Fixed one more line that was outputting notices
- Refactored some of the internal code to prevent notices and warnings from populating the error_log
- Introduced default values for some of the fields
- New feature: added functionality to display how much time is left. Use
es_time_left()within the loop. It will give you a human readable time difference in a variable, so you’ll need to use
echoon that. Uses
human_time_diff(), and accounts for the frequency of the cron job.
- Fixed a bug where automatic expirations would fire hooks, manual ones wouldn’t. Now all will fire hooks.
- Moved expiry functions over to built-in methods. Now hooks on post status transition and trash will also fire.
- Fixed (hopefully) the random draft-set bug.
- Changed comparison method for meta value.
- Fixed cron scheduling. Mad props to MonkeyPress for spotting the problem! Thank you!
- Removed some superfluous piece of code.
- Added some logic to test for empty values in the date.
- New feature: Default expiry time now added
- New feature: Status can be chosen to go into once expired (not just draft)
- New feature: Replaced functionality from pageload (init hook) to a cron job
- Removed a blocking error message. This is a BETA thing, sometimes the expiry date/time will not save due to a nonce verification error which I’m looking into. (as of 15th October, 2012)
- Removed a debugging related line.
- If the nonce fails, the whole script would die(), but there’s a call to an undefined function. That has been added back. It provides troubleshooting for me.
- Solved a problem that resulted in a warning if no post types are selected is now fixed (line 347) – thanks Kathy
- Solved an erroneous function call resulting in a failure to activate plugin (line 98)
- Added time as well, not just date. Uses current time, so make sure your timezone settings are properly configured (Settings->General)
- Made it work under 3.4.2
- Complete rewrite of the codebase
- Now uses builtin jquery-ui-datepicker (instead of outside file)
- Replaced raw SQL queries with proper WP functions
- Since I inherited the plugin, some problems might crop up again. Help me weed them out 🙂
- Added fallback for users with older versions of jquery that don’t have .on() function. Credit to Mark McLachlan for spotting this bug.
- Cleaned up code to make it easier to read!
- Put everthing into classes to tidy it up and the make it consistant with our other plugins
- Worked on some future proofing
- Put backward compatility for users using the esape_get_expiry_date() function so that it would work the same despite now being inside a class.
- Minor Bug Fixes
- Shortcode and function added for showing expiry date on front end.
- jquery ui datepicker bug fixed
- Fixed install and remove bug
- Fixed date not showing in meta box bug
- Allows the Selection of multiple post types
- Uses WordPress Options API for the options page
- Allows posts that have no expiry dates not to auto-expire
- 1st Stable Version!