Perhaps you could create a private utility taxonomy bookmarks
, where each term would correspond to a user. When ever a user is created a new term would be added to the utility taxonomy. As the user bookmarks or removes one’s bookmark from a post, your code would attach or detach the user equivalent term from the post.
The user ID could be saved as the term name and/or slug, which you could use to do “reverse lookups” e.g. turn the term name into a integer and query single user with it.
To find out who has bookmarked a post, you’d simply use get_the_terms($post_id, 'bookmarks')
, turn the term names to an array of IDs, and query the users with WP_User_Query(array('include' => $user_ids))
.
Related Posts:
- Get all user meta by meta key instead of ID
- Showing user ID on user main page from screen options
- List User order by ID in Descending order (Backend)
- mysql query two database tables, users and usermeta and sort by custom meta int value
- Get the users that my following users are following
- Uses for function: wp_update_user
- Store data from JavaScript object to custom table in user account
- Export WordPress User Meta to CSV/Excel
- How to change the value of a variable using input field?
- Display current user metadata on WordPress page
- Add another role to a user when they click a button?
- Private messaging – Getting and displaying the avatar/url of a message recipient
- Updating custom user meta
- Get author meta of all writers
- Let users register weight each day and save it in DB
- Import users and custom user meta from csv
- the_date() not working
- Query multiple custom post types in single loop
- Using WP_Query – how to display something IF there are no results
- Integrating WordPress to my website, while keeping my own authentication system
- What is the most efficient way to search users by their display name?
- Delete post revisions on post publish
- Getting the Current User
- How to sort results from a custom database table
- Authenticating to WordPress, using my own authentication two-factor system
- How can I default to all WordPress roles when parameter is not included in shortcode?
- Use two WP Query in template
- there’s a way to include a minimal WP for check only the current user, its roles (caps?) and then release/free it?
- Delete option value from array using update_option()
- get_usermeta() deprecated in favor of get_user_meta(). But why doesn’t it make use of it?
- spliting posts into two columns
- WordPress – query 5 posts with a specific post in top
- Create a new usermeta field for users
- Accessing the database from a plugin outside of action hooks
- Create WP_Query to search for posts by their categories or their parent/child categories
- ACF: how do I get the fields and its values of a specific group?
- Set WP_query ‘order’ option by another tables value
- Creating user status mode in WordPress
- WordPress default Search function inconsistent in WooCommerce Product Titles
- user_profile_update_errors hook not executing
- Adding number to date not working [closed]
- add_cap not working
- List users by meta_key and meta_value
- wordpress archive a user
- Call to undefined function get_userdata() in plugin
- WordPress SQL injection
- Which is the correct way to conditionally enqueue a CSS file?
- Change CSS based on is_user_logged_in
- Read array in php?
- How to list commenters and days since last commented
- How to overwrite orderby with add_query_var
- Can’t update multiple rows with $wpdb query
- How to display SQL query that ran in WC_Order_Query?
- Custom Post type slider with thumbnail navigation
- Shortcode for Listing Users from Meta Value?
- WordPress PHP syntax doesn’t seem to be working correctly
- php return username of currently viewed author profile
- Why my query does not run with prepare
- List of Events with Multiple Dates: Only NEXT Date
- Redirect to current user page upon link click
- Use of antispambot with $curauth->email
- WordPress Custom Query: Combining Two Functions
- Update user repeater meta (ACF) with another user meta field value
- Reject all malicious URL requests functions.php
- Generate a QR code when creating a new WordPress user
- Change wordpress’ database data using ajax – how to get current user id?
- Allow a user or role to view drafts and previews, but not other admin privileges?
- array wordpress when get is null
- User meta needed in query is serialized – how to unserialize safely?
- WP custom posts: filter results to custom taxonomy tag that corresponds to user meta field
- How to block specific user id in custom login form?
- Get current user id in function php
- how can I call a function when time expire
- Change user metadata on registration (show_admin_bar_front = false)
- Uploading/integrating custom user registration page
- Page template not working when logged out
- Get user by meta data key and velue
- Why does a header location on admin_head remove the query var I’m setting in the location?
- Update an additional user meta field with a string
- Offset with ajax load more posts duplicates
- Right way to display the_author_meta fields?
- wordpress more than one ajax request at the same time issue
- Adding user meta to post meta wp_insert_post() not working
- Pagination in WP Queries
- How can get all users by current user meta (array)?
- Changing WordPress author name in database
- Loop 1 user randomly
- “Where… like” query not working as expected
- How to ‘remember’ a site member’s last visited page?
- How to connect database table to each registered wordpress user.
- Problems With Query and/or Template Part and/or PHP
- How to callback custom field text
- Display a list of users with avatar filterable with alphabets
- Parse error: syntax error, unexpected ‘}’ in C:\wamp64\www\Proiect\aplicatie\user_check.php on line 18 [closed]
- How to insert a variable into a query parameter?
- WP_Query not returning results
- Check if username doesn’t exists
- WP query with variables gives no result for specific user
- Sorting a custom post type in pre_get_posts
- SQL query to retrieve the number of WordPress posts with all given categories