Skip Navigation

[Resolved] Post Expiration Based on Custom Field

This support ticket is created 5 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 5 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#1372601

Tell us what you are trying to do?
A custom post type was created for cancellations on a client's website. We want to make these cancellations automatically disappear from the front of the website on the date marked as the cancellation's end date (a custom field and form field) at 6pm.

Is there any documentation that you are following?
I attempted to use the following documentation: https://toolset.com/documentation/user-guides/automatic-post-expiration/. This was not successful as there is no way for me to tell the expiration which field to pull the date from. As some cancellations span several days, automatically deleting posts after 6 hours may delete it before the cancellation is over.

Is there a similar example that we can see?
Not that I have found.

#1372817

Hello,

Please elaborate the question with more details:
This was not successful as there is no way for me to tell the expiration which field to pull the date from

The post expiration date is stored in a hidden post custom field, field slug is "_cred_post_expiration_time", field value is in timestamp format.

You can find it by this:
When Forms creates posts that are set to expire, the expiration time is shown in the post editor, see the document you mentioned above:
https://toolset.com/documentation/user-guides/automatic-post-expiration/#post-expiration-settings-in-the-wordpress-post-editor

section "Post Expiration settings in the WordPress post editor", screenshot:
https://toolset.com/wp-content/uploads/2014/08/cred-post-expiration-for-single-post.png