我正在尝试使用“the_author_meta完成后,我需要在数组中传递值,并用“json\\u encode”返回该值。
让我展示一下:
$autor_id = $post->post_author;
$autor_name = the_author_meta(\'user_nicename\', $autor_id);
echo $autor_name;
 The
$autor_name echo 工作正常,但当我执行以下代码时,它会在脚本上返回null:
。。。
$results[\'author\'] = $autor_name;
$posts[] = $results;
}
return json_encode($posts);
 它返回:
"author":null如何使其显示作者姓名,如:"author":admin?