This documentation page is for Quform version 1 and may not be applicable for Quform 2 click here to visit the documentation for Quform 2.
This guide will show you how to set the default value of a Date element to be the current date.
Step 1
Go to the Date element settings, Optional tab and tick the option Dynamic default value and enter the Parameter name today
Step 2
Add the following code to the wp-content/themes/YOUR_THEME/functions.php file (or create a plugin for it).
1 2 3 4 5 6 7 8 9 10 11 | function my_date_today() { $now = current_time('timestamp'); return array( 'day' => date('j', $now), 'month' => date('n', $now), 'year' => date('Y', $now) ); } add_filter('iphorm_element_value_today', 'my_date_today'); |
function my_date_today() { $now = current_time('timestamp'); return array( 'day' => date('j', $now), 'month' => date('n', $now), 'year' => date('Y', $now) ); } add_filter('iphorm_element_value_today', 'my_date_today');