How to Get a WordPress User ID (Step by Step Guide)

You may be looking for a WordPress user ID for many reasons. Whether you need the user ID for custom code or debugging an issue in this tutorial we’ll show you how to find user IDs in WordPress.

Find User ID in WordPress Dashboard

This is by far the most simple way to get a WordPress user’s ID. First you’ll need to login to your WordPress admin dashboard.

Then head to Users/All users

From here you can select the user you want the ID of by clicking edit.

This will leave you to the user edit page. Here you’ll easily be able to see the user’s ID in the address bar of your browser.

In the example below our user’s ID is “3”.

See All WordPress User IDs (Using Reveal IDs Plugin)

If you want to see all user’s IDs in your WordPress dashboard you can use the Reveal IDs plugin.

After activating this plugin just head to Users/All users and you’ll see a column with the user’s ID.

This plugin is a great way to display WordPress user IDs in the admin for quick reference.

Get Current User ID (with PHP)

The easiest way to get the current logged in user ID with PHP is to use the get_current_user_id() function. This is the ideal solution if you’re building custom code and need the current user’s ID.

echo 'The current logged in user ID is: '.get_current_user_id();

Andy Feliciotti

Andy Feliciotti

Andy has been a full time WordPress developer for over 10 years. Through his years of experience has built 100s of sites and learned plenty of tricks along the way.

Leave a Reply

Your email address will not be published. Required fields are marked *

WordPress Tips Monthly

Get the latest from SmartWP to your inbox.