How to Build a Profile Form Using Post Submissions


Would you like to use WPForms to create a profile form using Post Submissions? You may want to have a category that is strictly a section on your site to show your author profile data. Using WPForms and WordPress Custom Fields this can be easily achieved and we’ll show you how!

Setting up the WordPress Custom Fields

Before beginning to build your form, you’ll need to figure out what custom fields you want in your WordPress posts. To create custom fields in WordPress, please review this tutorial.

For this tutorial, we’re going to be adding a profile page that includes the name of the author, their birthday, and some other personal but fun facts about the author.

Creating a profile form using the Post Submissions addon

Next, create your Post Submission form and add your fields to capture the information you want in your profile post.

Create your form to capture the profile fields

If you need any help in creating a form with the Post Submissions addon, please see this documentation.

Mapping the custom fields

Once you’ve added the fields to your form, you’ll now need to map these fields. Navigate to the Settings » Post Submissions tab to map these custom fields.

Type in the custom field name you set up in Step 1 and then from the dropdown, select the form field that maps to the correct field.

Map your form fields to your custom fields for your profile form

For example, we created a custom field in WordPress called birthday. In our form, we added a Date form field called Birthday.

On the Settings » Post Submissions tab, in the Custom Post Meta section, we typed in birthday for the WordPress custom field name and selected the Birthday form field from the dropdown.

Adding the snippet

Next, add the code snippet to your site.

 * Add a profile form using Post Submissions
 * @link

function wpf_post_submission_custom_content( $post_id, $fields, $form_data, $entry_id ) {

    // Only do this for form #1089.
    if ( absint( $form_data['id'] ) !== 1089 ) {

     * Field IDs, for reference.
     * 15 - Birthday
     * 16 - "My friends would describe me as"
     * 18 - "The most influential person in my life has been..."
     * 19 - "Five things I couldn't live without"

    // Below we're going to create our new custom content template,
    // using the field IDs listed above :)
    <h2><em>Author Profile</em></h2>
    <?php echo wpautop( esc_html( $fields[2]['value'] ) ); ?>
    <?php echo wpautop( esc_html( $fields[15]['value'] ) ); ?>
    <h3>"My friends would describe me as"</h3>
    <?php echo wpautop( esc_html( $fields[16]['value'] ) ); ?>
    <h3>"The most influential person in my life has been..."</h3>
    <?php echo wpautop( esc_html( $fields[18]['value'] ) ); ?>
    <h3>"Five things I couldn't live without"</h3>
    <?php echo wpautop( esc_html( $fields[19]['value'] ) ); ?>
    $content = ob_get_clean();

    remove_filter('content_save_pre', 'wp_filter_post_kses');
    remove_filter('content_filtered_save_pre', 'wp_filter_post_kses');

    $post = array(
        'ID'           => $post_id,
        'post_content' => $content,
    wp_update_post( $post );

    add_filter('content_save_pre', 'wp_filter_post_kses');
    add_filter('content_filtered_save_pre', 'wp_filter_post_kses');
add_action( 'wpforms_post_submissions_process', 'wpf_post_submission_custom_content', 10, 4 );

Please note that you will need to change the form ID and field ID(s) to match what you have in your form. For assistance with finding the correct form and field IDs, please see this tutorial.

And that’s all you need to create a profile form using the Post Submissions addon.

Your custom fields will now show on your profile form post

Would you like to be able to exclude certain posts and pages from your post submission forms? Take a look at our article on How to Exclude Posts, Pages or Categories From Dynamic Choices.

Action Reference: wpforms_post_submissions_process