Exporting Custom Templates

Would you like to manually create and export your own form templates? Custom templates enable you to build and use your own unique “starter” forms. If you tend to use many of the same fields and settings in your forms, or if you want to use the same form across multiple sites running WPForms, this can be a huge time saver.

This tutorial will show you how to create your own custom form templates from a new or existing form.

Note: The steps in this tutorial involve editing your site files. If you’d prefer a simpler way, see our guide on creating custom templates for more details.

First, make sure WPForms is installed and activated on your site. Then you can dive into the tutorial below.

Creating a Form to Use as a Template

To begin, you’ll need a form that will later be copied to create your template. You can use an existing form or create a new one.

When creating a new form, you can choose to either start with a blank form or use one of our existing templates and customize it.

On the Setup page, enter the name of your template in the Name Your Form field.

Naming a new form to use as a template

This title will be visible in the template library once you add your custom template to it, so make sure it’s something descriptive but not too long.

Adding and Customizing Fields

You can add fields to your template form by clicking on them in the panel on the left of the form builder, or by dragging and dropping them into the preview area.

Adding a Checkboxes field to a form

You can click on any field in the preview panel to open and customize its field options.

Customizing field options to use in a form template

Note: Looking for more guidance on setting up your template’s fields? You can learn more about all the available options in our tutorials on choosing the right form fields and customizing field options.

You may also want to consider adding conditional logic to your template form or creating a multi-column layout. All of your changes and customizations will be carried over into your template.

Configuring Form Settings

You can also customize your template form’s settings to configure default settings for future forms that will use this template. All changes to your settings will carry over when you export this form to use it as a template.


In your form’s General settings, you can edit your template’s title and add a description.

Customizing the description for a custom template form

Both of these will later be visible in the template library, so it’s a good idea to customize them. Make sure your description includes any key details for people using your template, such as its intended purpose.

Here you can also edit the submit button text, toggle anti-spam protection on or off, and add custom CSS if you wish.


In your template form’s notifications settings, you can create one or more default notifications for your template.

Customizing the default notification for a custom template

Note: Need help customizing your template’s notifications? Check out our tutorial on setting up notification emails for more details.


You can change your template’s default confirmation in your confirmations settings.

Customizing the default confirmation for a new custom template

Note: Want to learn more about creating form confirmations? See our guide to WPForms’ confirmations settings.

When you’re happy with your template, save your changes by clicking the Save button in the top right corner of the form builder.

Save form

Then click on the X icon to exit the form builder.

Exporting Form Code to Create a Template

Now that you’ve set up your template form, you can export it to add it to the template library.

First, you’ll need to get your template’s code by going to WPForms » Tools and clicking on the Export tab.

Accessing the WPForms Export tools

On this page, scroll down to the Form Template Export section, which provides a dropdown list of all of your forms. Select the form you created to use as your template and click the Export Template button.

Exporting a custom form template

The template code will then be generated and displayed on your screen.

The export code for a custom template

Copying and pasting this code to your site files will display this template in the form template library on the Setup page of the form builder.

Adding Template Code to Your Site

We’ll discuss three methods for adding your exported template’s code to your site. For all of these options, you’ll first need to make sure you have access to your site files.

All of the following options will work for adding the template to the same site you build it on, or to another site.

Method 1: Copying and Pasting Template Code to functions.php

If you would like the easiest and fastest solution for adding your custom template to your site, this is the way to go.

Open your site’s functions.php file by going to /wp-content/themes/YOUR-THEME/functions.php in your site’s files.

Then you can copy and paste the template code directly into functions.php. Save the file when you’re done.

Note: Keep in mind that any custom code in functions.php can potentially disappear if you update your theme. You can avoid this by creating a child theme or using a custom plugin as described below.

Method 2: Pasting Template Code into a New PHP File and Including It in functions.php

This method is very similar to the first one we covered, except that you will put the template code in its own file. This will help to protect it from accidental changes and keep your site’s code more organized.

If you choose this option, you will first need to open your site’s functions.php file in /wp-content/themes/YOUR-THEME/functions.php. Then paste in the following code:

This tells your site to run the code in a file named wpforms-custom-templates.php. Next, you need to create that file. Be sure to create it in the /wp-content/themes/YOUR-THEME/ directory (the same folder as functions.php).

Lastly, you’ll need to paste the template code into the wpforms-custom-templates.php file and save it.

Note: When creating your wpforms-custom-templates.php file, you must add <?php at the top of the file above the template code generated by the export tool. This is required for the file to be valid and for this method to work.

Method 3: Creating a Custom Plugin

This is the best option if you expect to change your WordPress theme in the future or want to use the same template(s) on multiple sites.

Creating a plugin might sound complex, but in this case, it actually only requires a few steps.

First, create a new file in your text or code editor and paste in the following:

Replace // Template code here with the generated code from the export tool and save the file as wpforms-custom-templates.php.

Then open your site files and navigate to /wp-content/plugins/. You’ll need to move the wpforms-custom-templates.php file you created to this folder to install your plugin on your site.

After moving the file, log into your WordPress admin area and open the Plugins page. There should be a plugin named WPForms Custom Templates. Click on Activate to activate your plugin.

Activating a custom plugin to add your custom template code to your site

Using Your New Custom Template

Once you’ve completed one of the three methods described above, your template should be ready to go!

To check that everything is working, go to WPForms » Add New. In the menu on the left side of the template library, click on Custom Templates.

Accessing the Custom Templates category in the form template library

Here you should see your custom template, including the form title and description you added earlier.

Using your custom form template

You can use it as you would any other form template.

Deleting the Original Form Template (Optional)

Lastly, you can delete the form you created in the first step if you’d like. The template doesn’t rely on the original form in any way, so you only have to keep it if it has associated entries that you need.

To delete the form, go to WPForms » All Forms, hover over the form’s row, and click Delete.

Deleting the original template form

Frequently Asked Questions

These are some of the most common questions we receive related to custom form templates.

Can I create a custom template without using code?

Yes. If you don’t feel confident updating your site files, you can use the built-in template generator in the form builder. For more details, be sure to check our guide on creating custom form templates.

Note: Think your template should be included in our template library? Feel free to send us your suggestion. We’d love to hear it!

That’s it! You can now save time by making your own custom form templates in WPForms.

Want to personalize your forms even more? Check out our guide on how to customize your WPForms validation messages.