0
我使用此代碼顯示wp中爲管理員和訂戶支持的每個用戶配置文件的用戶註冊日期。
add_action('show_user_profile', 'display_user_custom');
add_action('edit_user_profile', 'display_user_custom');
function display_user_custom($user) { ?>
<h3>Registration</h3>
<table class="form-table">
<tr>
<th><label>Registered Since</label></th>
<td><?php $udata = get_userdata($user-ID);
$registered = $udata->user_registered; echo date("d M Y", strtotime($registered)); ?></td>
</tr>
</table>
<?php
}
它工作,但日期是始終從用戶ID 1 $user-ID
它總是1.我與「私人瀏覽器」的倍數賬號登錄測試。