'Wordpress Get the same meta

i have problem about get post meta , i want to show meta by per user , but when i addet meta+user_id i cant get all some meta

My code is

<?php 


    $post_id = get_the_ID(); 
    $current_user = wp_get_current_user(); 
    
    
  // when many users add meta in post
  update_post_meta( $post_id , 'meta'.$current_user , 'value'.$current_user); 
  
  
i want like it
 meta          value
user 1        test 1
user 2        test 2
user 3        test 3
& more ...



 


Solution 1:[1]

Try this one:

<?php
$post_id = get_the_ID(); 
$users = get_users( array( 'fields' => array( 'ID' ) ) );
foreach($users as $user){
 get_post_meta($post_id , 'meta'.$user->ID ,true);
}
?>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jahid Hasan