AI Summary
Description
The wpforms_datetime_time_intervals filter is used to add additional time intervals available for the Time field Invervals dropdown.
Parameters
- $intervals
 - (array) Array of time intervals for the Time field Invervals dropdown.
 
Source
wpforms/pro/includes/fields/class-date-time.php
More Information
The filter is used to choose the time intervals for the Time field dropdown. It will utilize the time intervals in minutes. For example, if you want to add 2 hours, you would need to make the $intervals[ '120' ].
Examples
/*
 * Time intervals available for the Time field dropdown.
 *
 * @link https://wpforms.com/developers/wpforms_datetime_time_intervals/
 *
 * @param   array   $intervals   Used to determine the time intervals.
 * @return  array
*/
function wpf_dev_datetime_time_intervals( $intervals ) {
       
     // Add time interval
     $intervals[ '5' ] = esc_html__( '5 minutes', 'wpforms' );
     $intervals[ '120' ] = esc_html__( '2 hours', 'wpforms' );
     ksort( $intervals );
   
     return $intervals;
}
add_filter( 'wpforms_datetime_time_intervals' , 'wpf_dev_datetime_time_intervals', 1 );
Reference Articles
How to Create Additional Intervals for the Date Time Field Time Picker