I suggest you to save it on user entity. Use update_user_meta() and stock it as an array. In this case if you delete an user, all associates info will be delete too.
<?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);
?>
Related Posts:
- Assigning a role to a specific custom post type (and ignoring other post types)
- Community and User Generated Content Website: Have been thinking about Drupal but leaning on WordPress heavily
- Showing User’s Post Counts by Custom Post Type in the Admin’s User List?
- Correctly delete posts with meta and attachments [duplicate]
- Why are the comments disabled by default on my custom_post_types?
- Linking Two Post Types
- Custom Post Types on Category Pages
- How do I filter the excerpt metabox description in admin?
- Setting up custom post type archives in WP3.1? Any luck?
- Best Way to Create a List of Musician Gigs in WordPress
- Get custom post type by category in a page template
- Associating an “author” with a custom taxonomy
- TV Show database – Best way for structuring it?
- Add custom field to media attachment image attribute in post editor
- Why is the »_builtin« parameter not advised in »register_post_type()« for custom post types?
- How to add a select menu to this metabox code?
- Query posts by custom post type and custom taxonomy
- sort events based on event date custom field
- How can I get the last posts by user role?
- Having trouble with custom post type / meta box
- After deleting a post are terms, and custom meta deleted?
- Storing Custom Post Type Data in a Custom Table
- Get the post children count of a post
- Should I use Custom Post Types or something else
- Extend the wp_get_archives output with ‘?post_type=foo’?
- Sub-Sub-Blogs — creating and importing content into a custom sub-type
- Check Title Unique Or Not and If not error message and dont save
- 1 day after custom date change post status to draft
- removing custom tax & CPT slug, adding taxonomy term in front of custom type
- Show Two custom Post type and their posts on category page
- Custom post type and body_class: Remove “blog” class
- Setting posts per page in query_posts
- How to insert content from another Custom Post type into Post?
- Is there a way to have the view link on manage posts page to open in a new window or tab?
- Save metadata as a timestamp, display as a “pretty” date
- Display only one post each WEEK
- How to Mass Delete Images from Media Library
- Roles for Custom Post Types
- List custom taxonomy specific to one custom post type
- How to allow visitors to enter custom post type?
- Hide parent categories when clicked, and show it’s childs
- delete_published_posts does not work
- Users create/join groups
- Creating a Custom Post Type and Joining with Users
- Best structure / rewrite rules to achieve the following url
- Custom Post Type & Custom Menu Walker to append custom class for active post types
- 404 Error on form submission within custom post type
- Remove Quick edit for custom post type?
- How can I have different content for different countries?
- how to associate several authors to a custom post type
- List Categories (wp_terms) and count posts
- Displaying multiple post types on home page
- Conflict between wp_list_pages and get_posts – list pages not displaying
- Check if user has comment on current post
- How to insert data into meta box from another plugin?
- Sort custom post type by most current date picker
- YOAST SEO won’t work on custom post type archive [closed]
- List All Custom Post Types Posts in Nav Menu Dynamically
- Display custom post type for specific user
- How to export custom post type with ACF to individual file with automation?
- Different videos for different posts
- Add Class according to the order of appearance
- Preventing role reading others posts
- Post visibility option to theme front-end for author to select?
- How to keep a record of changes to a custom field?
- Custom taxonomy not saving correctly
- how to compare different timestamps in wp-query for events custom post types?
- Is there a (preferable built-in) way to check what custom queries are used in a theme?
- Can I get an auto-populated dropdown list of other custom posts in a custom post edit page?
- Display custom post front end filter by ACF equals current user
- Clone wp-admin/users.php (Users Admin Page)
- Show all post type posts in manage users posts column
- WordPress next post by ajax call on button click
- Remove plugin settings from post creation page for a user role
- How can I fetch all the dates from custom fields from various different custom post types and show / list them at one place in ascending order?
- Get all of a user’s posts (custom post type) then get cumulative value of a specific meta_key value from those posts
- Adding specific custom fields (images) to post excerpt
- Add WordPress users to a custom post type
- My post loop needs to have 8 different post templates
- Permanent Custom Post Type
- creating a custom post template
- UPDATED: Save a custom_field value when automatically creating a post using wp_insert_post
- Allow viewing the edit screen for a post type, but not make/save/publish/update changes
- Add role privileges of the custom post type
- Associate custom categories to different user IDs
- Display all post types together
- Collection of fields in a single post
- Display and Allow users to edit their own profiles
- Make title field multiline in the add new custom post page?
- What’s the best way to show custom post types? With page template it’s not perfect!
- Listing future posts together with normal posts
- WordPress and Unity high scores table
- Count of posts with meta_key filled in?
- Add Image field to CPT
- How to add custom column to Custom post page list?
- Page template with custom query instead of archive-xxx.php?
- show posts under custom post type with same autj
- cannot export data from CPT UI (books)
- REQUIRED: The theme uses the register_post_type() function, which is plugin-territory
- How to develop Knowledge center in WordPress Website