通过ID用户wordpress获取数据

时间:2018-10-08 14:22:53

标签: php database wordpress

我需要通过ID获取用户信息,但是它不起作用。有什么错误?

它什么也没显示。如果你能帮我谢谢

<?php
if(is_user_logged_in()) {
      global $wpdb;
    $current_user = wp_get_current_user();
    $results = $wpdb->get_results("SELECT postid FROM score WHERE ID={$current_user->ID}");
    echo $results[0]->postid;
} 
?>

0 个答案:

没有答案
相关问题