Support Forum
Support › MB User Profile › User Profile Fields not displaying in Elementor dynamic tags selector
Hello,
I have created several user profile fields. I have Metabox Elementor integrator installed and Elementor pro. However, user profile and fields are not showing up on elementor dynamic tags selector. The other post types are fine.
Please help with this.
Hello,
To display the user meta field, you can add a Heading widget > click on Dynamic tags. In the Site section, you can select the option User Info:
- Field: User Meta
- Key: add the field ID here.
screenshot https://imgur.com/gJXqggC
Let me know how it goes.
Hello Peter,
This solution provided only works for the native WP fields. Also, it doesn't have a provision for images and galleries as User Meta field isn't available there for selection.
Hello,
Yes, it works with some simple fields like text, textarea ... I will create a feature request and ask the development team to support the user meta fields in the future.
Hello Peter,
As a follow up to the above, I have decided to use shortcodes to display the fields.However, they are also not working. Whether is using inbuilt shortcodes eg [rwmb_meta id="ehven_adopting_family_profile_display_name"] or creating one
function display_display_name_shortcode($atts) {
// Extract shortcode attributes
$atts = shortcode_atts(array(
'post_id' => get_the_ID(), // Default to current post ID
), $atts);
// Get the 'display name' metabox field value
$display_name_value = get_post_meta($atts['post_id'], 'ehven_adopting_family_profile_display_name', true);
// Return the 'display name' metabox field value
return $display_name_value;
}
add_shortcode('display_name', 'display_display_name_shortcode');
What might be the issue?
Hello,
It's the user meta so you should use the function get_user_meta()
in your custom shortcode.
If you want to use the Meta Box shortcode, you should add the user ID and object type to the shortcode, for example:
[rwmb_meta id="ehven_adopting_family_profile_display_name" object_id="1" object_type="user"]
where 1 is the user ID.
Read more in the documentation https://developer.wordpress.org/reference/functions/get_user_meta/
https://docs.metabox.io/shortcode/