The wpforms_datetime_date_dropdowns filters labels and options within the date field’s dropdown format.


(array) (Required) Labels and number ranges used in date dropdowns.
(int) (Required) Form ID.
(array) (Required) Date field values and properties.



More Information

The wpforms_datetime_date_dropdowns filter is applied to an array containing date dropdown options. It can be used to customize the labels for the month, day, and year dropdowns, as well as which options are included within each of these dropdowns.

Note: Ranges for days, months, and years can accept only integer values.


In this example shown below the function will limit the months to January through June, the days from the 1st to the 15th and the year will start at 1980.

The function is also changing the labels from the default MM/DD/YYYY to M/D/Y.

Just remember to change the form ID from 25 to match the specific form ID you’re wanting to run your code on. Removing that check would run for all forms.

 * Filters labels and options within the date field’s dropdown format.

 * @link
 * @param  array  $dates    Months, Days, and Years arguments.
 * @param  int    $form_id  Form ID.
 * @param  array  $field    Date field values and properties.
 * @return array

function wpf_dev_datetime_date_dropdowns( $dates, $form_id, $field ) {

        // Only run on my form with ID = 25
        if ( absint( $form_id ) !== 25 ) {
            return $ranges;

	$ranges = array(
		'months'       => range( 1, 6 ),
		'days'         => range( 1, 15 ),
		'years'        => range( date( 'Y' ), 1980 ),
		'months_label' => esc_html__( 'M', 'wpforms' ),
		'days_label'   => esc_html__( 'D', 'wpforms' ),
		'years_label'  => esc_html__( 'Y', 'wpforms' ),
	return $ranges;
add_filter( 'wpforms_datetime_date_dropdowns', 'wpf_dev_datetime_date_dropdowns', 10, 3 );

Please remember to update the form ID in the snippet to match your own form ID. If you need help in finding your form ID number, please see this tutorial.

Article Reference: Customize the Date Time Field Date Options