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
- Uploading/integrating custom user registration page
- If user has clicked link add class and store using PHP/WordPress
- Updating User Profile information removes image
- Page template not working when logged out
- How can i limit the number of posts to the most recent 6 in my query?
- Allow specific user to edit a specific page
- How do I track which user clicked my button?
- How Can I Display the Last Modified Date for User Profiles on WordPress?
- Help hooking into user_register
- Get user by meta data key and velue
- Where do I implement this display of User Meta Data, and how to put it in a table?
- Why does a header location on admin_head remove the query var I’m setting in the location?
- getting the values of hidden inputs to use them in a php mysql query
- Update an additional user meta field with a string
- Offset with ajax load more posts duplicates
- Use WP user status (logged_in) to manage access to independent application
- Store custom field’s multiple values in one user meta key
- Get field in readable word
- Query to show average # of months all accounts with specific role have been active
- wordpress query returning unexpected results
- is_user_logged_in() not working in homepage
- not able to access $_POST on backend profile update
- Let user select the number of posts shown per page jquery error
- Right way to display the_author_meta fields?
- wordpress more than one ajax request at the same time issue
- Query doesn’t display text data with apostrophes
- (Who to follow) Twitter widget
- Adding user meta to post meta wp_insert_post() not working
- How to query a staging database?
- How to make a parent page for author.php?
- Get meta_query value by user meta array
- How to do a MySql query in WordPress?
- Can’t get_users info by using json_encode
- Creating a custom register form
- get_users when from meta key that has serialized values
- Editable Student file associated with basic User ID
- Pagination in WP Queries
- How can get all users by current user meta (array)?
- Adding users to another blog
- Changing WordPress author name in database
- Matching multi user
- Store stripe info as user_meta
- How can I display a query in a page?
- Include a custom field in mysql query
- Updating meta_value in a custom key
- Echo multiple tasks if a common function exists
- Loop 1 user randomly
- Get posts associated with media attachment
- Update only some custom user fields
- List users in a dropdown for login
- How to set max users to 17.000
- How to enqueue assets only on queried pages, excluding the page being queried?
- Limit the number of successful logins
- Trying to display user meta by “name” – not by “ID”
- main menu page redirects to user ID
- “Where… like” query not working as expected
- Unserializeing multiple column values that are stored in one database results variable
- How to ‘remember’ a site member’s last visited page?
- How to connect database table to each registered wordpress user.
- Check if values exists DB
- Trying to exclude posts from a category on the home page
- Problems With Query and/or Template Part and/or PHP
- Adapting a php array to WordPress
- If Elseif Query
- Arrange Category post manually when displayed
- How to callback custom field text
- Display a list of users with avatar filterable with alphabets
- How can I add more code to this?
- Hide a nav menu item based on get_user_meta results
- The search engine of my website finds only posts and not pages, how can I solve this problem?
- Cross origin ajax request always returns 0 when calling get_current_user_id();
- Does wp_query and query_posts affect website performance? [duplicate]
- Hide empty categories from get_categories
- Parse error: syntax error, unexpected ‘}’ in C:\wamp64\www\Proiect\aplicatie\user_check.php on line 18 [closed]
- Query Concatenation
- How to insert a variable into a query parameter?
- Forbid certain users to access a specific page
- wp_query on search results page showing all results every time
- WP_Query not returning results
- Check if username doesn’t exists
- One folder to be accessible by one user
- Show post like this image in my newssite [closed]
- WP query with variables gives no result for specific user
- A better way to write this php function