Would you like to combine values from multiple form fields into the post content when using WPForms Post Submissions? In this tutorial, we’ll show you how to merge content from different fields into a single post content area using a simple code snippet.
Creating the Form
First, you’ll need to create a form with multiple fields that you want to merge into the post content. For example, you might have several Rich Text fields or Single Line Text fields that contain different sections of content.
You’ll also need to have the Post Submissions addon installed and configured. If you need help setting up Post Submissions, please review our guide on Post Submissions addon.
Adding the Code Snippet
Add this snippet to your site:
If you need help adding custom code to your site, please check out our guide on adding custom PHP or JavaScript to your site.
Customizing the Code Snippet
Before using this snippet, you’ll need to make a few changes:
- On line 8: Update the form ID check (`463`) to match your own form’s ID
- On line 13 and 14: Update the field IDs (`2` and `3`) to match the fields you want to merge
- On line 17: If needed, adjust the separator between fields (currently a space: `’ ‘`)
And that’s it! You’ve now set up your form to merge multiple field values into the post content. Next, would you like to customize your post submissions further? Check out our tutorial on How to Set a Default Featured Image for Post Submissions.