It appears that you are storing the data in the post’s meta, not user’s meta. Therefore, you need to retrieve it by directly getting the meta for that post, not by doing a user query.
Let’s say your post’s ID is $post_id
:
First, retrieve the meta by get_post_meta()
:
$users = get_post_meta ( $post_id, 'post_liked_users', false );
I assumed that you are storing the data as multiple serialized ( based on your question ), so I set the last parameter of the above function to false, which will retrieve every meta, and we will try to extract the array:
if ( $users ) {
foreach ( $users as $user ) {
// $user[0] is the user-1 string here, and
// $user[1] is the integer ( their ID )
echo get_user_by( 'id', $user[1] )->display_name;
}
}
Related Posts:
- Create a global variable for use in all templates
- Build a content and excerpt grid loop with paging and options for # of posts
- What is the most efficient way to search users by their display name?
- Can i check if user is doing any ajax request?
- Why does “get_option” pull in the older value in options.php, rather than the newer value, on submission of a form?
- How to add 2 posts under another post? Formatting should be intact
- How can I default to all WordPress roles when parameter is not included in shortcode?
- Use wp_get_recent_posts with search term
- Remove query string specific key value
- How to prevent WP_Query function from returning all posts when empty?
- Display a specific category of products in shop page and disable code for specific actions
- Remove echo from shortcode
- Call to undefined function get_userdata() in plugin
- Security for data obtained from the database
- WP_Query | IF within $args array | Help me only add specific arguments if the argument is not blank
- change the default order of posts only for specific categories
- Post not populating for custom post type based on category selection
- Custom query vars filters problem with pagination
- How to get post category list as select in front-end?
- Displaying Event within two given time frames
- Use of antispambot with $curauth->email
- Uses for function: wp_update_user
- Let current user know pending posts counts using wp_query
- Output product category link from WP_Query
- Isn’t Returning Value While Using SELECT COUNT(*) FROM {$wpdb->prefix}
- “pre_get_posts” orderby custom date field in different format?
- 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?
- How to exclude meta no index pages from wp_list_pages
- WP query posts BUT show the most recent and one per author
- Get current user id in function php
- Ajax filter with loadmore button
- posts_per_page displays only 2 posts instead of 4 posts
- Delete post meta by serialized meta value
- Display current user metadata on WordPress page
- Modify post image in full size
- WP_Query To Display Product Of Brand On Taxonomy Page
- Add another role to a user when they click a button?
- Query to show average # of months all accounts with specific role have been active
- is_user_logged_in() not working in homepage
- Custom Post type Ajax search results
- Can’t get_users info by using json_encode
- Matching multi user
- My query keeps looping infinitely ! how to stop it?
- Private messaging – Getting and displaying the avatar/url of a message recipient
- How can I display a query in a page?
- Loop 1 user randomly
- Display Year and Month from custom field + Age Calculator
- insert thumbnail image from php script
- Weird Behaviour: Not all WordPress Posts appearing
- main menu page redirects to user ID
- List sibling pages widget, exclude current page
- Get author meta of all writers
- How to get category pages to look like a certain archive page?
- Display a list of users with avatar filterable with alphabets
- Cross origin ajax request always returns 0 when calling get_current_user_id();
- How to modify this function to exclude also the post belonging to a specific category?
- WP query with variables gives no result for specific user
- a problem in class in class-wp-hook.php
- /page/2/ redirect to 404
- Add adjacent post function inside custom recent post function
- Custom Admin Menu Report for Specific User ID
- wp_logout action hook is not firing
- Developing a “fallback” for empty wp_query results based on post dates
- Word Count Function Preventing Permalink Editing
- Add a Second Menu to a theme that only support 1 menu
- How to speed up a wordpress function with multiple loops?
- How to Display Image Meta underneath EVERY image in EVERY post
- Custom excerpt function re-factoring
- Looking for most performant way to execute several similar WP queries within shortcodes
- API response to be stored locally
- Warning: Use of undefined constant HTTP_USER_AGENT – assumed ‘HTTP_USER_AGENT’ (this will throw an Error in a future version of PHP)
- PHP can I add line numbers to file_get_contents()
- Adding tawk.to code just before body tag on functions.php file
- How to change a public function inside a class of a plugin?
- get_the_terms – only top level
- syntax issue on php 7.4
- How do I fetch all comments per post via WP REST API?
- How do I publish only one page to production after making changes on staging?
- Have CSS Class Added with `is_page()` WP function
- Slide in Panel WordPress Post
- Changing Woocommerce flat rate every nth number of items
- Shortcode content output but not in correct place
- Convert all images to PNG on file upload
- WP_Query loop, does not display special characters in title correctly
- How to restrict page access to logged-in users?
- is_page “range” for if statement?
- Calculations in functions.php [closed]
- If search results empty then execute certain code
- Shortcode return function with link href inside PHP
- Can’t load WP function into external function
- Hide post if matches current month and year
- Count the number of times the search form template gets included on a page
- PHP code inside shortcodes
- Get the last month with posts using a recursive function…
- Limiting woocommerce line_total decimal length
- Add itemprop Schema.org Markup to li Elements in wp_nav_menu
- Use WP_Query in shortcode
- Get all user meta by meta key instead of ID
- Run a filter when a walker runs