wordpresselementormeta-key

What is the meta_key for user registration date in WordPress?


I am pretty new to WordPress.

I am setting up a profile page in WordPress, and I am trying to display the registration date using the meta_key in the profile page to show the date the user joined.

What is the meta_key for user registration date, if it exists, if it does not how can I create a meta-key? Plus how can I return it in the 'DD/MM/YYYY' date format?


Solution

  • The key for user registered date (actually date and time) is user_registered. It's saved as a string in Y-m-d H:i:s format. "DD/MM/YYYY" isn't a PHP/Wordpress date format, but I think you mean d/m/Y.

    How you extract the data will depend on how you're getting the user. So for current user you could try:

    $registered_date = date( 'd/m/Y', strtotime( wp_get_current_user()->user_registered ) ) ;
    
    echo 'You registered on ' . $registered_date . '.' ;