Post expiry date in the form saving as different date in the actual post.
I have pushed a fresh copy of the live site to staging site
hidden link
I submitted this form with expiry date: 18/07/2021 when you go into the post the date is showing 10/08/2021 hidden link hidden link
FYI - I removed recaptcha in the form as it was giving an error because it's the staging site/domain
ERROR for site owner: Invalid domain for site key
[cred_field field='recaptcha' value='' urlparam='' class='form-control' output='bootstrap']
<br>
Hello. Thank you for contacting the Toolset support.
Post expiration time is saved with the meta key namely "_cred_post_expiration_time" that holds the date field value as unix timestamp.
That is why we will require to save the timestamp with the post meta key "_cred_post_expiration_time".
I've added the following code to "Custom Code" section offered by Toolset:
=> hidden link
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']==17313){
$expiry_date = $_POST['expiration-date']['timestamp'];
update_post_meta($post_id, '_cred_post_expiration_time', $expiry_date );
}
}
Thank Minesh, strange it's worked for the last 3 years.
I tested on staging site, it's working again now, but I added the code to our live site and tested, but its not working on the live site. Are there any other settings or code I need to add or change?
No - I just added the code I shared and I can see it working. Please make sure you replace the original form ID, on staging its 17313 - it may be different on your live site.
Is the code snippet you added is active? if not, can you please activate it. If that does not help I will require admin access details to your live site with problem URL where you added the form.