How to Use the Post Submissions Addon to Post to Other Post Types


Would you like to use the Post Submissions addon to post to other post types besides just standard blog articles? If you have posts on your site such as portfolio items, digital products, recipes, and more, you can use a small PHP snippet to easily have your form post to these other post types. In this tutorial, we’ll walk you through the steps needed to achieve this.

By default, the Post Submissions addon will take any submission and add it to the WordPress post type of post.

For the purpose of this tutorial, we’ve already created our custom post type that will create movie reviews on our site.

Creating the form

First, you’ll need to create your form.

If you need assistance in this, please review this tutorial.

We’re going to create a form that will collect movie reviews from all around our community. The form will only need the Name, Email Address, Movie Title, and Review Content for that movie.

we've now created the form to accept the post submissions. In the next step, we'll add the custom snippet to bring it all together.

Adding the snippet

Now it’s time to add the snippet to our site.

If you need any help on how and where to add snippets, please check out this tutorial.

 * Change the default post type for Post Submissions addon.
 * @link
function wpf_dev_post_submissions_post_args( $post_args, $form_data, $fields ) {
	// Only run this snippet on the form ID 649
    if ( absint( $form_data[ 'id' ] ) !== 649 ) {
        return $fields;
	// Assign any submissions that come through this form to the post type
		$post_args[ 'post_type' ] = 'movies';
	return $post_args;
add_filter( 'wpforms_post_submissions_post_args', 'wpf_dev_post_submissions_post_args', 10, 3 );

The form ID we’ve created for this tutorial is 649, the custom post type we’re using is movies. You’ll need to update these references in the snippet above to match your own form ID and post type name.

Any form submission from this form ID 649 will automatically be assigned to the custom post type Movies.

Using this filter you can now use the Post Submissions to post to other post types

And that’s it! You’ve successfully used your form to post to custom post types. Would you like to use this addon to also create a form for profiles? Check out our tutorial on How to Build a Profile Form Using Post Submissions.

Filter Reference: wpforms_post_submissions_post_args