Tet banner

Custom Fields
Support MB User Meta How to display custom user meta field on website?

  • Creator
  • #28849
    Resolved Danny

    I'm new to MB and got stuck with this.

    I've created a Select field (called Status) and added this to the Users using MB Builder.

    Then tried adding the shortcode [rwmb_meta id="status"] to a page.

    Nothing displayed. And I couldn't find any other topic mentioning how to do this, nor in the FB group.

    I apologize in advance if this wasn't the right forum to post this in.

Viewing 10 replies - 1 through 10 (of 11 total)
  • Author
  • #28851
    Long Nguyen

    Hi Danny,

    You need to pass two attributes object_type and object_id (user ID) to the shortcode.

    [rwmb_meta id="color" object_id="1" object_type="user"]

    Get more details here https://docs.metabox.io/shortcode/#examples


    Hey Long, thank you for responding.

    Hmm.. if object_id is meant to retrieve the user ID, then this shortcode may not be usable. Because each user profile will have its own status reflected.

    Secondly, I tried using this
    [rwmb_meta id="status" object_id="2" object_type="user"]

    But the status value did not output when user_id=2 viewed the page with the shortcode.

    Long Nguyen

    Hi Danny,

    If you want to get the user ID dynamically for each logged in user, you can use the WordPress function get_current_user_id() and follow the documentation to get the user meta https://docs.metabox.io/extensions/mb-user-meta/#getting-field-value


    Hmm.. seems like Metabox isn't as simple as I would've thought it to be for a non-programmer. (-_-||) And most of the documentation is very code driven.

    Guess I'd either shelf this, or take a much longer time wrapping my head around it.

    Long Nguyen


    Meta Box is a developer tool so you need to have basic coding knowledge to do more advanced cases with Meta Box.


    I see.

    Well, I've got Elementor Pro and I've installed the MB integrator plugin.

    Now I'm trying to get the status by using User Info (User Meta).

    For the meta key, I've tried using both Field ID and Field Group ID, but I still can't pull the data in Elementor.

    Is the meta key something else?

    Long Nguyen


    Please refer to this topic to get the author (user) meta for a post


    Unfortunately, linked post wasn't helpful. I'm familiar with retrieving the common User Info via Elementor Pro. And when I tried to view your screen recording in the quoted post, it tells me; This item has exceeded its view limit!

    Anyway.. here's a screenshot of the meta key I'm asking about; https://imgur.com/a/OhBNkEr

    I've tried entering my field ID as you mentioned in another thread (https://metabox.io/support/topic/meta-field-key-without-shortcode/#post-24727). But it's still not retrieving the Select field's value or label.

    If this helps, here's the generated code from my field group via MB builder:

    add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' );
    function your_prefix_function_name( $meta_boxes ) {
        $prefix = '';
        $meta_boxes[] = [
            'title'  => __( 'Applicant status', 'your-text-domain' ),
            'id'     => 'applicant-status-mb',
            'type'   => 'user',
            'fields' => [
                    'name'    => __( 'Status', 'your-text-domain' ),
                    'id'      => $prefix . 'applicant_status_mb',
                    'type'    => 'select',
                    'options' => [
                        'pending'    => __( 'Pending documents', 'your-text-domain' ),
                        'review'     => __( 'In review', 'your-text-domain' ),
                        'processing' => __( 'Processing', 'your-text-domain' ),
                        'improve'    => __( 'To improve', 'your-text-domain' ),
                        'complete'   => __( 'Completed', 'your-text-domain' ),
        return $meta_boxes;
    Long Nguyen


    I see the dynamic tag User Info shows the user meta as well, screen record https://share.getcloudapp.com/4gunJRvB

    And please notice that this tag helps you to show the status of the logged-in user.


    Hey Long, I managed to retrieve the value after resetting my WordPress. Not sure what happened there.

    I've got 1 last question..

    I read here (https://docs.metabox.io/fields/select/) that Select will return the Value of the field. Is there a way to display the Label in Elementor?

Viewing 10 replies - 1 through 10 (of 11 total)
  • You must be logged in to reply to this topic.