Untitled
unknown
plain_text
a year ago
548 B
8
Indexable
function validate_oib_field($event_id) {
// Fetch the event data
$event_data = get_post_meta($event_id, 'mec', true);
// Check if OIB field exists in the event data
if (isset($event_data['oib'])) {
$oib = $event_data['oib'];
// Validate the OIB length
if (strlen($oib) !== 11) {
// Prevent the event from being saved and return an error
wp_die(__('OIB must be exactly 11 characters.'));
}
}
return true;
}
add_action('mec_before_event_save', 'validate_oib_field');
Editor is loading...
Leave a Comment