WordPress displays the registration time of the login user in the frontend

When using WordPress to build a website, some users want to display the user registration time in the frontend, but WordPress does not have this option, so how to realize this function?

It’s very simple. Although this function is not common, it doesn’t work much. This function is basically used in a user centric site.

First, copy the following code to the functions.php In the article.

//WordPress displays the registration time of the login user in the frontend

function user_registered_date(){
    $authorID= $userinfo->id;
    $user = get_userdata( $authorID );
    $registered = $user->user_registered;
    echo 'Registration time' . date( 'Yyearmmonthdday', strtotime( $registered ) );

Then add the code in the appropriate place of the theme template:

<?php if ( is_user_logged_in() ) { user_registered_date();} ?>
//Only the logged in user is visible。
Related Article
Two methods of automatically renaming uploaded files in WordPress

When we edit and publish articles, we often upload some pictures, audio and other files. Interested webmasters will find that Read more

WordPress tutorial: adding author filtering options to the background article list

When there are multiple users publishing articles in our site, in order to facilitate the administrator to view the article Read more

WordPress adds the number of SQL queries at the bottom

An excellent woodpress theme is definitely that the less SQL consulting is used, the better. How can we see how Read more

Some WordPress articles can be seen after comments / replies

If we want to hide part of the content of the article and need the user's comments and replies to Read more

Leave a Reply

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

To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-spam image