如何在作者简介中显示作者注册日期和时间

how can i show author registration date and time in author profile

如何在作者个人资料中显示作者注册日期和时间,我想在 single.php 页面简介信息中显示作者注册日期和时间。没有任何插件。

我已经尝试过这些技巧,但我没有成功

https://wordpress.org/support/topic/get-the-date-a-user-registered?replies=5 https://wordpress.stackexchange.com/questions/77876/show-user-registration-date-in-wordpress

您可以这样使用the_author_meta函数:

<?php 
    echo the_author_meta( 'user_registered', 1 ); 
?>

..其中第一个参数是字符串参数,第二个(在本例中为 1)是用户 ID。这是明确的。更隐含地说,您可以简单地传递用户 ID。这必须在 WP 循环内完成:

<?php 
    $user_ID = $post->post_author;
    echo the_author_meta( 'user_registered', $user_ID ); 
?>

如果您使用的是自定义身份验证插件或某种扩展,则需要 return 来自该对象的 ID。但是,如果是这种情况,您的问题还不清楚。

我正在使用这段代码,它工作正常。

 <?php
      global $wp_query;
      $registered = date_i18n( "M m, Y", strtotime( get_the_author_meta( 'user_registered', $wp_query->queried_object_id ) ) );
      echo 'Member since ' . $registered;
     ?>