Home / members / List last five registered users
  • How to List last five registered users

    list-last-five-registered-users

    Place this PHP code anyplace within your wordpress theme and it will display the latest 5 registered member to your website.

    ( click code to copy )

    wordpress snippet : PHP

    <>
    <h2>Latest registered users</h2>
    <ul>
    <?php
    $usernames = $wpdb->get_results("SELECT user_nicename, user_url FROM $wpdb->users ORDER BY ID DESC LIMIT 5");
    foreach ($usernames as $username) {
        echo '<li><a href="'.$username->user_url.'">'.$username->user_nicename."</a></li>";
    }
    ?>
    </ul>
    

    ( WordPress codex functions, hooks, in this snippet. )

    register, _n, wp,