Showing User Logins

If you’re running a WordPress website with multiple users, administrators, authors, contributors or just normal subscribers, it’s useful to be able to see your site’s recent user logins, even if only for security reasons. If you want to know many of your subscribers never actually log on to your site, who has logged in since last week, or who logged in last night and messed up the site, here’s how to find out!

One of the nice things about WordPress is that if you want to do something, there’s almost certainly a plugin that will do it for you. Although there’s almost certainly a plugin to show a user’s last login, it won’t take you more than a minute to do it yourself using the code shown below.

Instructions:

First, open the functions.php file in the theme you’re using. A child theme, we assume. Next, copy this first snippet of code into functions.php.

The code above is used to record login dates and times. Obviously, you now want to be able to see this information, so you have to tell WordPress where it should go.

We want to add this information to the ‘users’ section of your backend admin section, so go back to your functions.php and paste this code after the snippet you just added.

That’s actually all there is to it! To test, save your functions.php and go the ‘users’ page in your site backend. You should have a view more or less the same as shown below.

user-logins

Recent Posts

  • Plugin Review - WP Rocket

WP Rocket Review

Review - WP Rocket cache plugin In case you didn't already know, WP Rocket is [...]

  • WordPress Security

WordPress Security – 2

WordPress Security Plugins You can take care of the basics of WordPress security yourself, and [...]

  • WordPress Security

WordPress Security – 1

WordPress Security Out of the box, WordPress is a relatively secure publishing platform, but a [...]

  • feat-starter-plugs

Essential plugins at startup

Startup plugins and themes Like most people who create WordPress website regularly, we have what [...]

  • feat-notification-mails3

User Notification Emails

Changing the 'from' in notification emails Stopping WordPress sending user notification emails to new members [...]

  • feat-logins-1

Display User Logins

Showing User Logins If you're running a WordPress website with multiple users, administrators, authors, contributors [...]