• Resolved millonario

    (@millonario)


    Hello, I’m trying to get the user data when you register, but I do not know how to do it, by putting the following code:

    <?php get_user_meta($user_id, ‘META_KEY’, true); ?>

    It does not show me anything, I try to put it in the file single.php.

    If you can help me, I would appreciate it very much

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @millonario,

    If you have the correct $user_id then it should work after adding an echo.

    Try this:

    <?php echo get_user_meta($user_id, 'meta_key', true); ?>

    Thanks

    Thread Starter millonario

    (@millonario)

    Thank you very much

    When I assign a user ID <?php echo get_user_meta(‘1’, ‘meta_key’, true); ?>, it works correctly, but when I leave it like this:

    <?php echo get_user_meta($user_id, ‘meta_key’, true); ?>

    It does not work .. do you know if there is a way to do it automatically? Detect the user ID that posted the post?

    Thank you so much

    Hi @millonario,

    If you are on the single.php template which means Template for Single posts. Then you can simply use this :

    <?php echo get_user_meta( $post->post_author, 'meta_key', true); ?>

    Hope it helps.

    Thanks

    Thread Starter millonario

    (@millonario)

    It works perfect, Thank you very much

    @millonario,

    Glad to hear that it worked out perfect for you.

    Let us know if you need further help.

    Also leave us a review about your experience with WPUF.

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Show user registration data’ is closed to new replies.