Skip Navigation

[Résolu] How to set default value for post field ==> field type "Date"

This support ticket is created Il y a 5 années et 10 mois. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 19 réponses, has 2 voix.

Last updated by Engedi Il y a 5 années et 10 mois.

Assisted by: Shane.

Auteur
Publications
#912035
empty expiry date.jpg

Hi Shane,

The code only works with the new post. It will automatically add the desired date to the post. But for existing post, if i clear the date, and save it again, it will not work anymore. The date picker will just show the empty date (attached is the old post after clearing the date and updating it).

#912049

Shane
Supporter

Languages: Anglais (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Thats because if the code has a date stored in the database it won't work.

This code is meant to work for posts without the date field already filled in. So if you were to remove date field value and save it wouldn't work because its detecting that their is a value for this field already there.

It only runs when the date field is empty.

I'm under the assumption that you only want this code to work when new posts are created to ensure that the dates are there.

Thanks,
Shane

#912147

Hi Shane,

It is helpful. Thank you for taking time..

#912436

Shane
Supporter

Languages: Anglais (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

I hope i didn't come off as offensive in my previous response 🙁

Was I able to resolve the issue tho. Does it work as you want it to?

Please let me know.

Thanks,
Shane

#912573

Yes, It does help. Thank You very much.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.