Hello, my friends,
Unfortunately, I have some questions. Let me introduce my problem first. I need to reschedule around 100 different events every 1st of November, and this is time-consuming. So, I had the idea to create an action hook to reschedule all the events. I started with a shortcode function to test it on a single recurring event. I will post the code below. The code works fine, but unfortunately, the tickets are not created, and the old ones aren’t deleted. Do you have any information about that?
function update_event_data_shortcode($atts) {
$current_date = date('d.m.Y');
$current_year = date('Y');
if (isset($atts['event_id'])) {
$event_id = intval($atts['event_id']);
$EM_Event = em_get_event($event_id, 'event_id');
$new_start_date = date('y', strtotime('+1 year')).'-04-01';
$EM_Event->start_date = $new_start_date;
$new_end_date = date('y', strtotime('+1 year')).'-10-31';
$EM_Event->end_date = $new_end_date;
if (strtotime($current_date) >= strtotime('01.11.' . $current_year)) {
$EM_Event->save(); //Event is saved with new time intervall, but tickets are not created?
}
}
}
add_shortcode('update_event_data', 'update_event_data_shortcode');
- This topic was modified 1 hour, 15 minutes ago by .