Mapping WPForms Checkbox Values to ACF Checkbox Fields

Would you like to connect WPForms checkbox submissions with Advanced Custom Fields (ACF) checkbox fields? By default, WPForms Post Submissions addon sends checkbox labels as plain strings, while ACF expects an array of stored keys. This mismatch means values may not display correctly inside the ACF meta box when editing a post.

In this tutorial, we’ll show you how to use the wpforms_post_submissions_process action hook to dynamically map WPForms checkbox submissions to ACF checkbox field keys.

Adding the Code Snippet

To map checkbox values, you’ll need to add a custom code snippet to your site. If you need help adding custom code, please see our tutorial on adding code snippets.

The snippet below shows how to update an ACF checkbox field named age based on a WPForms checkbox submission:

Customizing the Snippet

You can modify this snippet to match your own setup:

  1. Form ID: Replace 83 with the ID of your form in line 13.
  2. WPForms field ID: Replace 1 with the ID of your checkbox field in line 17.
  3. ACF field name: Replace 'age' with the field name (or field key) of your ACF checkbox in line 18.

If you’d like to handle multiple checkbox fields, extend the snippet with a field map array of WPForms IDs to ACF names.

And that’s it! You’ve now successfully mapped WPForms checkbox values to ACF checkbox fields so that they appear correctly inside the WordPress post editor.

Reference Action

wpforms_post_submissions_process