• Tim Burkart

    (@bigmoxy)


    Hi,

    I have a custom user registration form which adds a meta key/value. My question is how can I display that value on the user profile page?

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Lax Mariappan

    (@lakshmananphp)

    $user_id = get_current_user_id(); // Get the current user ID
    $meta_value = get_user_meta($user_id, 'your_meta_key', true); // Replace 'your_meta_key' with your actual meta key
    
    echo 'Your Meta Value: ' . $meta_value;

    Add the code snippet to your user profile file or template and check if it works.

    Please note that, when the user is not logged in, they should be redirected to the login page.

    This code assumes that the user is logged in.
    Thread Starter Tim Burkart

    (@bigmoxy)

    Thank you @lakshmananphp!

    I have a couple follow up questions as I am new to WP customization. Where can I find the user profile file or template? The site in question has a child theme so may I assume I can copy the file/template there for customization?

    Also, I would like the meta data to be displayed only to administrators. The users with the meta data do not have user profile access.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How can I customize the user profile display to include a meta key/value?’ is closed to new replies.