Meta Key for Profile
-
Hello, Team!
I am creating a shortcode to display the customer city/address at front end.
Forminator Meta Key for the address is address-1.
Inside my shortchode:
$current_user->display_name ===> displayed NAME (CORRECT)
$current_user->address-1 ===> displayed -1 (WRONG)How can I get the correct meta key for the address?
Best regards,
Mike
The page I need help with: [log in to see the link]
-
Hi @mikesuccess
I hope you are doing well.
Could you please upload your code to https://gist.github.com/ and we can verify how you called the $current_use?
Best Regards
Patrick FreitasHi Patrick @wpmudevsupport12
Many thanks for your prompt response. Here is the link:
https://gist.github.com/happyfinance/b03237eb42993ff2576331352081754b
Thank you.
Hi @mikesuccess,
I am afraid, I am a bit confused about what you are exactly trying to do.
From the code that you have shared, it seems you need to display the user account details of the currently logged-in user using a shortcode.
Can you please briefly explain what you are exactly trying to do and where you need to display the data?
Kind Regards,
Nebu JohnHi Nebu,
I am creating a shortcode to diplay a field at front end. I am choosing telephone number {phone-1} from the registration form. What meta key to use inside my shortcode?
Thank you.
Hello @mikesuccess !
I trust you’re doing well today!
In this case, when creating the form you’ll need to add the custom meta fields like this (on the User Registration tab on the form’s edit screen):
The Label will become the meta_key in this case: https://imgur.com/a/YSMBt9l
And you can retrieve it using:
$phone = get_user_meta($user_id, 'phone', true);Hope this helps!
Best regards,
PawelHi @mikesuccess
I hope you are doing well and safe!
We haven’t heard from you in a while, I’ll mark this thread as resolved.
Feel free to let us know if you have any additional questions or problems.
Best Regards
Patrick Freitas
The topic ‘Meta Key for Profile’ is closed to new replies.