如何获取ACF字段的meta值(wordpress)?

How to get the meta value of the ACF field (wordpress)?

我需要获取 ACF 字段的元值。
名为 'submitdate' 的 ACF 字段(格式 => 日期时间选择器:Y-m-d H:i:s)已经有数据“2021-06-11 17:23:36”
我试过下面的代码,但它只显示正确的 $post->ID,它不显示 $submitdate.
控制台没有错误。
请告诉我如何回显该字段的值好吗?

我试过的查询:

$args = array(
'post_type'         => 'project',
'posts_per_page'    => -1,
'author'            => get_current_user_id(),
'name'              => get_the_title()
    );
$query = new WP_Query($args);

    if ($query->have_posts()) {
    global $post;
    while ($query->have_posts()) {
    $query->the_post();
    $submitdate = get_post_meta($post->ID, 'submitdate', true);
echo $post->ID;
echo $submitdate; 
  }
}

我也试过,它显示当前日期和时间,而不是字段中的值:

$submitdate = get_field("submitdate", $post->ID);



谢谢。

/* I had same issue before few days and resolved with below function */

/* please try this line of code */
    
  $args = array(
    'post_type'         => 'project',
    'posts_per_page'    => -1,
    'author'            => get_current_user_id(),
    'name'              => get_the_title()
   );
  $query = new WP_Query($args);

    if ($query->have_posts()) {
    global $post;
   
    while ($query->have_posts()) {
         $query->the_post();
         $submitdate = get_field('submitdate', $post->ID ); // if changed field name then update key in this query

          echo $post->ID;
          echo $submitdate; 
     }
   }