Custom Fields
Support MB Frontend Submission How to set the post title to my Name input field?

  • Creator
  • #9634


    Probably a very basic question, with a very simple answer…

    I am new to MB. Built my first meta boxes, and using the Frontend Submission extenstion to create a first post.
    One of the fields is a Name field. Another field is “Elevator pitch”
    How can I set the post title to this Name field?
    Similar: how can I set the post extract to the value of “Elevator pitch”?

    I see a lot of coding in the documentation. I was expecting with all these extensions that I woulld not have to deal with this coding myself.

    Thanks for your help.

Viewing 10 replies - 1 through 10 (of 11 total)
  • Author
  • #9635
    Anh Tran


    The post title is displayed in the post_fields attribute of the shortcode. Please use the MB Frontend Submission to add other fields to the form.

    In your situation, it sounds like changing the label for post title from “Post Title” to “Name”.

    So, please create a folder in your theme called mb-frontend-submission. Inside that folder, create a sub-folder called post. And inside post, create a file title.php, which contains the following code (don’t worry, just copy and paste):

    $title = $data->post_id ? get_post_field( 'post_title', $data->post_id ) : '';
    $field = apply_filters( 'rwmb_frontend_post_title', array(
        'type' => 'text',
        'name' => esc_html__( 'Name', 'rwmb-frontend-submission' ),
        'id'   => 'post_title',
        'std'  => $title,
    ) );
    $field = RWMB_Field::call( 'normalize', $field );
    RWMB_Field::call( $field, 'admin_enqueue_scripts' );
    RWMB_Field::call( 'show', $field, false, $data->post_id );

    That’s it!

    Please try and let me know how it works.


    Hi Anh,

    Thanks for your very quick respons. Impressed!

    Done as you requested, but no result.
    See here the title.php that I created like you said.!AiZg1q2e9vdxhBlxbs_Mz30DdS2c

    I have also tried with the same folder structure as for the template, like the Frontend Submission documentation describes.
    So I tried with as well as without the folder “template-parts” in the middle.
    No effect.

    Anh Tran

    I see you use the folder template-parts. It should be without it (probably you did it, but please try again), like in this screenshot:

    View post on

    I’ve just tested and here is the result:

    View post on


    It’s not working unfortunately.
    I added quite a number of fields in the meta box. For some reason, it is even no longer creating a post when I press the submit button.

    Let me know if you need access to the site.

    Anh Tran

    Yes, please send me a temporary account to I’ll check it.


    Done. I have created a page frontend-submission.
    Good luck.

    Anh Tran

    I’ve checked on your site and I see you created a field with ID post_title. But as it’s a field in a meta box, it can’t be a post field.

    To add post field, you need to change the shortcode to:

    [mb_frontend_form id="dominantgegevens,diensten" post_fields="title"]

    And the template for post title now works.

    Just a note: post fields (such as post title, editor, thumbnail, etc.) are not part of meta boxes, so you can’t wrap it in tabs. They will appear above the tabs.

    Here is the screenshot of the page:


    Thanks, that works great. I now see how to fill the standard WP post attribues, except the Category. I have tried to use the fiels Taxanomy, but that shows me a dropdown box, while I just want to hide it and assign a fixed value to it.
    Any suggestion?
    (I understand that this is different from my original question. If you want me to close this one and open a new thread, let me know.)

    Anh Tran


    To assign a fixed value to the category, use the taxonomy field. And set the default value (std parameter) to the category ID. Then that default value will be used when you submit the form.

    In order to hide the field, just add a custom CSS class to the field (like hidden) and add this line into your theme, or in Customizer > Additional CSS:

    .hidden { display: none; }

    That’s it. Please try and let me know how it goes.


    The issue is that I don’t understand how to set the default value to the category in the meta box. I don’t see it in the options, and if I need to set it through custom attribute, then how?

Viewing 10 replies - 1 through 10 (of 11 total)
  • The topic ‘How to set the post title to my Name input field?’ is closed to new replies.
grid gear info copy caret-up caret-down trash