I have a page called event and set the bellow rewrite rule to store the event ID in the URL:
add_action('init', function () {
add_rewrite_rule(
'^event/(\d+)/?$',
'index.php?pagename=event&event_id=$matches[1]',
'top'
);
});
add_filter('query_vars', function ($vars) {
$vars[] = 'event_id';
return $vars;
});
e.g. mysite.com/event/37/
Works fine until user clicks on Review button and CiviCRM removes the id from URL:
e.g. mysite.com/event/?civiwp=CiviCRM&q=civicrm%2Fevent%2Fregister&_qf_Register_display=true&qfKey=CRMEventControllerRegistration...
Is there a way to keep the ID or get the event ID using other solution?