Filters labels and options within the date field’s dropdown format.
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.
- (array) (Required) Labels and number ranges used in date dropdowns.
- (int) (Required) Form ID.
- (array) (Required) Date field values and properties.
Below explains what is contained in the array and the context of how it is used.
$ranges = apply_filters( 'wpforms_datetime_date_dropdowns', array( 'months' => range( 1, 12 ), 'days' => range( 1, 31 ), 'years' => range( date( 'Y' ), 1920 ), 'months_label' => esc_html__( 'MM', 'wpforms' ), 'days_label' => esc_html__( 'DD', 'wpforms' ), 'years_label' => esc_html__( 'YYYY', 'wpforms' ), ), $form_id, $field );
Note: Ranges for days, months, and years can accept only integer values.