A filter used to populate all the arguments of the submission such as title, post type etc when using the Post Submissions addon from WPForms.


(array) (Required) Arguments from the post submission such as Category ID, Tag ID, Author ID etc.
array Form settings/data.
array Sanitized entry field values/properties.



More Information

The wpforms_post_submissions_post_args fires immediately when the submission is processed to set the post title, category, etc inside the post.


In the example code, you’ll see we’re first checking the form ID to make sure it matches the form that’s being targeted. Then we’re checking a specific field (by the fields ID) to see if it’s empty.

Just remember to change the form ID from 1378 to match your form ID and change the '10' to match your field ID.

We’re going to see if the dropdown matches FAQ and if it does, change it from the post type of post to my_faq.

 * Action that fires during form submission.
 * @link
 * @param  array  $post_args Sanitized entry field. values/properties.
 * @param  array  $form_data Form data and settings.
 * @param  array  $fields    Sanitized entry field values/properties.
 * @return array

function wpf_dev_post_submissions_post_args( $post_args, $form_data, $fields ) {
    if ( absint( $form_data['id'] ) !== 1378 ) {
        return $fields;
	if ( ! empty( $fields['10'] ) && $fields['10']['value'] === 'FAQ' ) {
		$post_args['post_type'] = 'my_faq';
	return $post_args;
add_filter( 'wpforms_post_submissions_post_args', 'wpf_dev_post_submissions_post_args', 10, 3 );

Tutorial Reference: How to Use the Post Submissions Addon to Post to Other Post Types