Automatic post, custom post and page-expiration?

This may also be a feature suggestion (e.g. for "Scheduled Content").

I am searching for a way (or a reliable Plugin) that gives me the possibility to give (first and foremost) pages an expiry date (as well as custom post types).

Yes, I know, there is "Post Expirator", but this plugin seems to me not well maintained - and I am in need of a plugin (or way to be able to do that) that is reliable - and sure to still work with WordPress 4.1, e.g. My faith in a plugin that still is labeled "compatible up to 3.8.3" isn't extremely high here...

Any suggestions? Or is there an extension for "Scheduled Content" that makes it possible to let whole posts/pages have a timeframe when they are published (ideally afterwards they are drafts).

What do I need that for?
I am designing a hotel website. And e.g. our packages and package-deals should only be visible during the timeframe they are on offer - so, "WinterBlues" (which will be a page) shouldn't be visible but from January to Mid-March. If it would be a draft afterwards, that would be a treat as in that case we just had to adjust the rates and give the page a new schedule for the next year...

  • Ash

    Hello @Matthias

    I hope you are well today and thanks for asking the question.

    As this feature is not included I am moving this thread into feature request area. I am afraid, I can't give you any ETA as it depends on votes from other members in this thread.

    About "compatible up to 3.8.3" message, sometimes the developer is too lazy to update information, but the plugin might still works. It is better to leave a question in that plugin support forum so that users from that plugin or the developer can reply you.


    • Matthias

      maybe you could have a look at this one and tell me whether that would work (reliably) - that would be a great help

      function acf_set_expiry($post_id){
        //Check if the post has a start_date value
          if(get_field('start_date', $post_id)){
          //if it does, remove the default expiration action
                  remove_action( 'save_post', 'expirationdate_update_post_meta');
      if(get_field('end_date', $post_id)){
                  $date = get_field('end_date', $post_id);
                  $date = get_field('start_date', $post_id);
              expirationdate_update_post_meta_acf($post_id, $date);
      //modified update_post_meta function
      function expirationdate_update_post_meta_acf($id, $date) {
          // don't run the echo if this is an auto save
          if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
          // don't run the echo if the function is called for saving revision.
          $posttype = get_post_type($id);
          if ( $posttype == 'revision' )
          } else {
          //'M j, Y' is the format my ACF date field is outputting - can be differ from each setup!
              $formatted_date = DateTime::createFromFormat('M j, Y', $date);
              $month	 = intval($formatted_date->format('m'));
              $day 	 = intval($formatted_date->format('d'));
              $year 	 = intval($formatted_date->format('y'));
              //I am not using time in my ACF field, so I am setting it manually to the end of the day.
              $hour 	 = 23;
              $minute  = 59;
              $opts = array();
              $ts = get_gmt_from_date("$year-$month-$day $hour:$minute:0",'U');
              // Schedule/Update Expiration
              $opts['expireType'] = 'draft';
              $opts['id'] = $id;
      add_action('acf/save_post', 'acf_set_expiry', 1);
    • Matthias

      Hi there, Jose,

      thanks for your answer. Yes I am using that plugin. But if I see that correctly this plugin only allows me to schedule content within a post or page. The post or page itself stays accessible after that time.

      That's not useful for me as there will be a page showing all current package-deals (working basically like a "recent posts"-page) - so using the scheduled content would NOT remove the expired package-deal from that site - only if someone clicks on it, he will see an empty page... not what I need :wink:

  • Jose

    Hey @Matthias,

    Looking into your code I realized that you are actually using the "Post Expirator" plugin (I misunderstood that as per what you said in your first post), and you are trying to customize it to work with Advanced Custom Fields.

    At the first read, your code looks correct, but I don't know these 2 plugins enough.

    My advice would be to contact the plugin developer.
    In the readme.txt file included in the plugin, he mention that the support requests might be missed:

    [Feature Requests]( Please enter all feature requests here. Requests entered via the plugin website or support forum may be missed.

    Maybe you can try to reach him directly.

    From a "reliability" perspective, I can say that the code seems very well written. Also, it provides a handy debug module, and that's a huge thing. Definitively, it worth to try it and fix it if there are issues.

    I'll be glad to help you if you can be more specific on what errors are you getting in the log when you run the plugin in debug mode.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.