我建议您将其保存在用户实体上。使用update\\u user\\u meta()并将其存储为数组。在这种情况下,如果您删除一个用户,所有关联信息也将被删除。
<?php
$user_id = get_current_user_id();
$user_events = get_user_meta($user_id, \'user_events\', true);
$user_events[$event_id] = $event_id; //you can also stock more infos, i use event_id as key to don\'t have duplicate event by user
update_user_meta($user_id, \'user_events\', $user_events);
?>