Hello,
We have a jobs section with posts that have an expiry date.
When the expiry date has passed, the post are not being deleted, and the date changes to 01/01/1970.
add_action('cred_save_data', 'func_set_custom_post_expiration_date_time',10,2);
function func_set_custom_post_expiration_date_time($post_id, $form_data){
// if a specific form
if ($form_data['id']==4896){
I see from your screenshot you shared that you did not setup the "Post expiration" setting on your form: "Set expiration date for post created or edited by this form".
Given that this is based on custom code then the debugging ability we have here is quite limited as this is outside of the realm of what is possible by the plugin by default.
Can you explain if it actually worked when Waqar had provided the solution and if it did what changed that caused it to stop working.
Now, what I suggest what if you try to set above post expiration setting and set the post to be "Trash" if post is expired and then create a new post for testing purpose and see if that works as expected. If not, whats not working as expected we will require to review that.
Thanks for the instructions, I set to 'Trash' and tested but it's not taking the date the user fills out in the form. Its changing to the setting: Post will expire in 4 Weeks after this form is submitted.
Can you please share problem URL where you added your form as well as admin access details. Let me check whats going wrong with your setup.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
I just checked with my local test installation where I imported the Toolset form and post type Job as well as associated custom fields.
When I checked on my local test install it just works fine. I set the yesterday's date that is 24th March as post expiration date and I've set the post expiration settings from Toolset Form to be post expired after 1 minute after we submit the post and I've also changed that CRON should be run every one minute by adding the following code:
And I've set this cron schedule so that CRON should run every minute from: Toolset => Settings => Forms => Other section.
I can see its working as expected.
But when I try to create the post using the form, I've created the post with title "first" using the form but it seems on your site the CRON should be blocked or not working as expected.
=> enlace oculto
You can see the post with title "first" post stays as it is.
Can you please test on some other server where there should be no restrictions or blocking or even try to check on localhost or other server.
But when I try to create the post using the form, I've created the post with title "first" using the form but it seems on your site the CRON should be blocked or not working as expected.
=> enlace oculto
You can see the post with title "first" post stays as it is.
The post is not removed. Can you please check if CRON is allowed on your server as it seems the CRON is not fired as expected in this case.
Hi, I checked with WPengine, they turned on the server Cron and confirmed Cron is working for the staging site. I retested adding a job with expiry date 01/04/22 but the job still remained on the list - enlace oculto
It does not seem that CRON us running on your site as I created a post and it stays there.
Either you have to test on server where there will be no CRON restriction or you can share with me another server where you are sure that CRON is running or alternatively I can share a demo site source which you will have to install on your server and if that does not work that means CRON is not running on your server.