Wordpress 获取相同的元数据

Wordpress Get the same meta

我有关于获取 post meta 的问题,我想按每个用户显示 meta ,但是当我添加 meta+user_id 我无法获取所有一些 meta

我的密码是

<?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 ...



 

试试这个:

<?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);
}
?>