Skip Navigation

[Résolu] Set CRED Date field to today

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

Marqué : 

This topic contains 4 réponses, has 4 voix.

Last updated by katjaL Il y a 9 années et 4 mois.

Assigned support staff: Caridad.


How do I set the date field in a CRED form to the date of today ?


Dear Luit,

You can write a custom shortcode that provides todays date in timestamp format. Something like this:

add_shortcode('wpv-post-today', 'today_shortcode');
function today_shortcode() {
  return time();

Then you can use this shortcode in your cred form:

[cred_field field="date" post="book" value="[wpv-post-today]"]

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.



Works like a charm, thanks !


When I use this code, it returns only the date in my date-time field. What do I need to change?



Hi, I stumbled on this when searching the current time thing. Here's the code that fetches the current time according to time zone of the site (in settings). This does fetch also the time, not only date.

add_shortcode('wpv-post-today', 'today_shortcode');
function today_shortcode() {
return current_time(timestamp,0);