PressTigers

Displaying Last Login Time of Users in WordPress

Member oriented and user profile managing sites may need the functionality of showing last login of users on their WordPress Dashboard. Using wp_login hook, last login display functionality can be achieved easily.

To record the user activity of last login, you need to add the following code in your functions.php file:

The following code will return the last login time. You can use it directly in your theme template by calling the function. Additionally, it will register a shortcode for the same function so that it can be inserted later in WordPress back-end pages/posts.

To display last login time, insert the registered shortcode i.e. [last-login-time] in back-end pages/post. Use the following command to insert the shortcode in template files:

User Comments

Leave a Reply

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

    Get in Touch