Title: Wrong Expiring Date
Last modified: January 24, 2024

---

# Wrong Expiring Date

 *  Resolved [Guillermo Figueredo](https://wordpress.org/support/users/cleftune/)
 * (@cleftune)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/wrong-expiring-date/)
 * We are using this function below to add the expiring date programmatically, but
   no matter what date we enter, the plugin always schedules it for the next day:
 * function CCC_add_expiring_date_request( $post ) { $deadline = get_field( ‘deadline’,
   $post ); if( $_POST && array_key_exists( ‘input_9’, $_POST ) ) { $deadline = 
   $_POST[ ‘input_9’ ]; } $date = new \DateTime( $deadline . ‘ 00:00:00’, wp_timezone());
   $date->add( new \DateInterval( ‘P1D’ ) ); $timestamp = date( ‘U’, strtotime( 
   $date->format( ‘Y-m-d H:i:s’ ) ) ); $opts = array( ‘expireType’ => ‘draft’, ‘
   id’ => $post, ); do_action( ‘publishpressfuture_schedule_expiration’, $post, 
   $timestamp, $opts ); //postexpirator_schedule_event( $post, $date->getTimestamp(),
   $opts ); } add_action(‘pending_requests’, ‘CCC_add_expiring_date_request’, 10,
   1);

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

 *  Thread Starter [Guillermo Figueredo](https://wordpress.org/support/users/cleftune/)
 * (@cleftune)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/wrong-expiring-date/#post-17370408)
 * *I am happy to share the staging site separately via email
 *  Plugin Author [Steve Burge](https://wordpress.org/support/users/stevejburge/)
 * (@stevejburge)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/wrong-expiring-date/#post-17370434)
 * Hi [@cleftune](https://wordpress.org/support/users/cleftune/). Thanks for using
   PublishPress Future.
 * We do have code samples on our site: [https://publishpress.com/knowledge-base/programmatically-schedule-actions/](https://publishpress.com/knowledge-base/programmatically-schedule-actions/)
 * However, we’re not able to support custom code here for Free users on WordPress.
   org.
 *  Thread Starter [Guillermo Figueredo](https://wordpress.org/support/users/cleftune/)
 * (@cleftune)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/wrong-expiring-date/#post-17370740)
 * Yes, we are using that code.
 * We are going to test is trying to add the function on another action, but there
   seems to be an incompatibility that was not there before.
 * The code was working until recently.
 *  Thread Starter [Guillermo Figueredo](https://wordpress.org/support/users/cleftune/)
 * (@cleftune)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/wrong-expiring-date/#post-17371691)
 * We are very happy with your plugin, and if you can assist us with this issue 
   we would be more than happy to pay for that. Either by buying the pro version
   or just paying directly for a fix of this issue. For some reason, no matter where
   I use the function, the expire date is always today+1. We dont know when and 
   why it stopped working as expected.
 *  Plugin Support [Riza Maulana Ardiyanto](https://wordpress.org/support/users/rizaardiyanto/)
 * (@rizaardiyanto)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/wrong-expiring-date/#post-17381841)
 * [@cleftune](https://wordpress.org/support/users/cleftune/) Sorry our support 
   option is limited, and it’s not included on troubleshooting custom code on our
   plugin.
 * You might want to consider hire dedicated developer on this.

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

The topic ‘Wrong Expiring Date’ is closed to new replies.

 * ![](https://ps.w.org/post-expirator/assets/icon-256x256.png?rev=3118683)
 * [Schedule Post Changes With PublishPress Future: Unpublish, Delete, Change Status, Trash, Change Categories](https://wordpress.org/plugins/post-expirator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/post-expirator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/post-expirator/)
 * [Active Topics](https://wordpress.org/support/plugin/post-expirator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/post-expirator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/post-expirator/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [Riza Maulana Ardiyanto](https://wordpress.org/support/users/rizaardiyanto/)
 * Last activity: [2 years, 4 months ago](https://wordpress.org/support/topic/wrong-expiring-date/#post-17381841)
 * Status: resolved