KD Kumar
Forum Replies Created
-
Hi Gasoj,
Thanks for clarifying the requirement. We understand the use case now — you want a simple datetime value available in standard WordPress post meta so that tools using
get_posts()/WP_Querycan sort Eventixa events without needing to know about Eventixa’s custom tables.We have a compatibility solution you can use right away.
Add the following snippet to your active theme’s
functions.phpfile or, preferably, a small custom plugin. It hooks into Eventixa’s existing event-settings save action and creates synchronized datetime compatibility metadata whenever an event is saved.It creates the following post meta values:
_evx_start_datetime→2026-08-20 19:00:00_evx_end_datetime→2026-08-20 21:00:00_evx_start_datetime_utc→ UTC equivalent_evx_end_datetime_utc→ UTC equivalent_evx_duration→ duration in seconds_evx_all_day→1or0
add_action( 'eventixa_event_settings_saved', 'my_eventixa_sync_datetime_compatibility_meta', 30, 2 ); function my_eventixa_sync_datetime_compatibility_meta( $post_id, $values ) { $post_id = absint( $post_id ); if ( ! $post_id ) { return; } $post = get_post( $post_id ); if ( ! $post || 'eventixa_event' !== $post->post_type ) { return; } if ( wp_is_post_revision( $post_id ) ) { return; } if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } $start_date = isset( $values['start_date'] ) ? trim( (string) $values['start_date'] ) : ''; $start_time = isset( $values['start_time'] ) ? trim( (string) $values['start_time'] ) : ''; $end_date = isset( $values['end_date'] ) ? trim( (string) $values['end_date'] ) : ''; $end_time = isset( $values['end_time'] ) ? trim( (string) $values['end_time'] ) : ''; $all_day = ! empty( $values['all_day'] ); if ( empty( $start_date ) ) { my_eventixa_delete_datetime_compatibility_meta( $post_id ); return; } if ( empty( $start_time ) ) { $start_time = '00:00'; } if ( empty( $end_date ) ) { $end_date = $start_date; } if ( empty( $end_time ) ) { $end_time = $all_day ? '23:59:59' : $start_time; } $start_time = my_eventixa_normalize_time( $start_time ); $end_time = my_eventixa_normalize_time( $end_time ); if ( false === $start_time || false === $end_time ) { my_eventixa_delete_datetime_compatibility_meta( $post_id ); return; } $start_datetime_string = $start_date . ' ' . $start_time; $end_datetime_string = $end_date . ' ' . $end_time; $timezone = \Eventixa\Support\DateTimeFormatter::timezone(); try { $start_local = new DateTimeImmutable( $start_datetime_string, $timezone ); $end_local = new DateTimeImmutable( $end_datetime_string, $timezone ); } catch ( Exception $exception ) { my_eventixa_delete_datetime_compatibility_meta( $post_id ); return; } $start_local_string = $start_local->format( 'Y-m-d H:i:s' ); $end_local_string = $end_local->format( 'Y-m-d H:i:s' ); $utc_timezone = new DateTimeZone( 'UTC' ); $start_utc = $start_local->setTimezone( $utc_timezone ); $end_utc = $end_local->setTimezone( $utc_timezone ); $start_utc_string = $start_utc->format( 'Y-m-d H:i:s' ); $end_utc_string = $end_utc->format( 'Y-m-d H:i:s' ); $duration = max( 0, $end_utc->getTimestamp() - $start_utc->getTimestamp() ); update_post_meta( $post_id, '_evx_start_datetime', $start_local_string ); update_post_meta( $post_id, '_evx_end_datetime', $end_local_string ); update_post_meta( $post_id, '_evx_start_datetime_utc', $start_utc_string ); update_post_meta( $post_id, '_evx_end_datetime_utc', $end_utc_string ); update_post_meta( $post_id, '_evx_duration', $duration ); update_post_meta( $post_id, '_evx_all_day', $all_day ? 1 : 0 ); } /** * Normalize an Eventixa time value. */ function my_eventixa_normalize_time( $time ) { $time = trim( (string) $time ); if ( '' === $time ) { return false; } if ( preg_match( '/^\d{2}:\d{2}$/', $time ) ) { return $time . ':00'; } if ( preg_match( '/^\d{2}:\d{2}:\d{2}$/', $time ) ) { return $time; } if ( preg_match( '/^\d{1,2}$/', $time ) ) { $hour = absint( $time ); if ( $hour > 23 ) { return false; } return sprintf( '%02d:00:00', $hour ); } return false; } /** * Delete all Eventixa datetime compatibility metadata. */ function my_eventixa_delete_datetime_compatibility_meta( $post_id ) { $meta_keys = array( '_evx_start_datetime', '_evx_end_datetime', '_evx_start_datetime_utc', '_evx_end_datetime_utc', '_evx_duration', '_evx_all_day', ); foreach ( $meta_keys as $meta_key ) { delete_post_meta( $post_id, $meta_key ); } }For existing events, after adding the snippet, open the event in WordPress and click Update once. That will generate the compatibility metadata for that event.
After that, a standard query can sort events by the combined datetime value.
Because the values are stored in
Y-m-d H:i:sformat, their lexical order is also their chronological order.The local datetime values use Eventixa’s configured timezone, while the
_utcvariants are available when an integration needs timezone-neutral values.Eventixa’s normalized event/occurrence tables would still remain the canonical source for Eventixa itself, especially for recurring events. These post-meta values are intended as a compatibility layer for standard WordPress queries and third-party integrations.
Your feedback around
WP_Query, migration tools and ElasticPress has been very useful, and we’re also considering whether a small compatibility layer like this would make sense as part of Eventixa itself in a future update.Thanks again for explaining the use case in detail.
Hi Gasoj,
Thanks — the ElasticPress example makes the interoperability concern much clearer.
Before we decide on the best approach, could you share a little more about the original requirement you’re trying to solve in your integration?
In particular, it would be helpful to know:
- What do you want to do with Eventixa events through standard WordPress APIs or third-party tools?
- Which event values would you expect to be available in
postmeta? - What meta keys/data format would be most useful for your use case?
For example, are you mainly looking for something like:
_evx_start_datetime→2026-08-20 19:00:00_evx_end_datetime→2026-08-20 21:00:00or would you also expect other event properties to be exposed as standard post meta?
We already maintain the normalized Eventixa tables as the canonical source for Eventixa’s own querying, particularly because recurring events can have many individual occurrences. However, we’re open to exposing a small, well-defined set of compatibility metadata if it provides meaningful interoperability with tools such as ElasticPress, custom
WP_Queryimplementations, migration tools, page builders, and other WordPress integrations.Understanding your actual use case and the fields you need will help us avoid adding unnecessary duplicate data while still making Eventixa easier for developers to integrate with.
Since you’re already working directly with the Eventixa data structure, your input here would be particularly useful.
Thanks again!
Hi Gasoj,
You’re very welcome — and that sounds like a useful migration tool! 🙂
Yes, once you get into Eventixa’s data structure, you’ll notice that the dedicated
evx_*tables handle much of the data that would otherwise require more complexpostmetaqueries, especially for occurrences, bookings, attendees, and related event data.We’re glad the explanation helped simplify your implementation.
If you run into any questions while working on the migration from The Events Calendar (
tribe_events) to Eventixa, feel free to open another topic. We’ll be happy to clarify how Eventixa stores or expects particular data.Thanks again for taking the time to explore Eventixa – events calendar, tickets and booking in depth and for sharing your feedback with us!
Hi Gasoj,
Just a quick update — Eventixa 1.0.2 has now been released, and it includes the fix for the payment currency validation issue you reported.
After updating to Eventixa 1.0.2, you should now be able to select and save currencies other than USD correctly.
Thank you again for reporting the issue and helping us improve Eventixa.
I’ll mark this topic as resolved for now. If you experience any further issues with currency settings or anything else related to this fix, please feel free to reopen the topic or create a new support request. We’ll be happy to help.