User Meta Shortcode

By: ignis van niekerk | Asked: 05/26/2022
ForumsCategory: Code HelpUser Meta Shortcode
ignis van niekerk asked 2 years ago
Hi, My form registers a user with an address field, I want to pull the metadata from the address field to populate when the user logs in, the metadata saves the field as "Billing Address" but I need the code for the metadata to display for line1, line2, city, etc. this shortcode does not work [user_meta key="line1"] please assist
1 Answers
Victor Font answered 2 years ago
The [user_meta] shortcode draws its values from custom fields stored in the WordPress user tables. You have to map the form values to the custom fields in the registration add-on. Did you check the wp_usermeta table to verify the values exist for your target user? https://formidableforms.com/knowledgebase/user-registration/#kb-user-meta
ignis van niekerk replied 2 years ago

Hi Victor, thank you, yes the values are in the wp_usermeta table, it is also mapped in the E2PDF addon, I am just struggling to figure out the shortcode for the user_meta key as the [user_meta key="line1"] does not work, the [user_meta key="Billing Address"] does however work but it pulls the values in on line1.

Victor Font replied 2 years ago

When you look at the data in wp_usermeta, the key is whatever value is in the meta_key field for that particular data item. If you stored the entire address into a single billing address field, then you have to parse the array manually. When you store the address, make sure you save each field individually, not as a single address field.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right