Meta Box
Support › Meta Box AIO › Store month in local formatResolved
I added a custom field with a date picker and date format "d F o".
The month I want it to be in Dutch but it stores in English.
Example: 10 January 2023 is saved. Wanted: 10 Januari 2023 (month is spelled different).
How can this be achieved?
Kind regards,
Ivan.
Hello,
You can use the filter hook rwmb_{$field_id}_value to format the date value before saving it to the database. For example:
rwmb_{$field_id}_value
add_filter( 'rwmb_date_03tqmu7k17qs_value', function( $new, $field, $old, $object_id ) { $timestamp = strtotime( $new ); $new = wp_date( 'd F o', $timestamp ); return $new; }, 99, 4 );
replace date_03tqmu7k17qs with your field date ID. Please read more on the documentation https://docs.metabox.io/filters/rwmb-field-type-value/ https://developer.wordpress.org/reference/functions/wp_date/
date_03tqmu7k17qs
This was too easy and I should have found this in the forum.
It works and thank you for your help!