WordPress Query Current User ID

I would like to echo mysql data based on the current user that’s signed into WordPress.

Example:

Read More

SELECT * FROM wp_users WHERE wp_users.id=”current_signed_in_user”

So it will post all information from the table “wp_users” where the “wp_user.id” is the current signed in user’s ID.

Thanks in advance.

Related posts

2 comments

  1. Resolved my issue by doing the following:

    <?php
    $current_user = wp_get_current_user();
    
    $query ="SELECT * FROM wp_users, wp_devices, wp_readings WHERE wp_users.ID='$current_user->ID'
    
    ?>
    

    🙂

Comments are closed.