1

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?

Muhammad Zohaib
  • 307
  • 1
  • 5
  • 15
Seesharp
  • 333
  • 2
  • 10
  • 24

1 Answers1

5

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 . '.' ;
CK MacLeod
  • 932
  • 6
  • 10
  • Thank you, I ended up changing into a short code so that I can add it using Elementor on word press – Seesharp May 10 '20 at 18:53
  • function User_regisetered_date() { $registered_date = date( 'd/m/Y', strtotime( wp_get_current_user()->user_registered ) ) ; return $registered_date; } add_shortcode('Registered_date', 'User_regisetered_date'); – Seesharp May 10 '20 at 18:54