Default datetimes in repeatable fields
-
I’ve got a need for a repeatable
text_datetime_timestamp
field, and I’d like to set the default to “today + a month”. In my code, I have:$cmb2->add_field( array( 'id' => 'my_prefix_showtime', 'name' => __( 'Showtimes', 'my-custom-post' ), 'type' => 'text_datetime_timestamp', 'repeatable' => true, 'default' => time() + MONTH_IN_SECONDS, ) );
This works fine for the first new date (it shows up as a formatted date a month in the future); however, any future fields get what appears to be the raw
time() + MONTH_IN_SECONDS
output.Is there any way to ensure that every datetime field in the
repeatable
box gets a valid date?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Default datetimes in repeatable fields’ is closed to new replies.