Why Not to Create a WordPress Contact Form Without a Plugin

Landscape photo of a volcano in the ocean with some greenery in the forefront

By

Posted On:

It’s not uncommon for me to be asked why you shouldn’t just write your own form, without a plugin using PHP and JavaScript code to add a form to your WordPress site. This is one of the things that happens since I create a WordPress form builder plugin for a living, all totally normal. Also, it’s a totally reasonable question and I’m a nerd, so let’s do this.

Technically speaking, to process a form you need an HTML form — something you can write in your page template and an endpoint to process the form request and WordPress provides a lot of options for creating custom endpoints on a site. Here is a nice long article I wrote about four of those options.

But don’t. Making a WordPress contact form without a plugin is, most of the time, not worth it.

Look — I’m the guy who makes a form builder plugin so I have a bit of an interest in people using a WordPress form builder. But, I also spent the last few years obsessing over a web form that creates other web forms. This is something I’ve thought a lot about. Probably thought too much about.

Faster to Prototype & Faster to Finished Product

A form, no matter how you build it, is best thought of as an interface. Interfaces require design and design requires a process of iteration from idea to prototype to finished product. If you’re creating a form by writing code, building a prototype to discuss with your client or stakeholders is an entirely separate process.

If you use a form builder plugin, you can make a rough draft of your form and send it to a client for review. Even if the form isn’t perfect, you can now discuss what it will take to finish it by looking at the form in context — on the site it will live on — as opposed to looking at a sketch or mockup.

When you’re ready to finish the form, you’re not starting from scratch. Just finish the form, no need to start a complete coding process.

Quick tip: When making a prototype form to send to a client, for any fields that don’t work as intended yet – use the field description to describe what a field would do in the final version.

Complexity & Efficiency

In general, it’s true that the more things a piece of software can do, the less efficient it is at each of those things. A WordPress contact form plugin can do a ton of things, but with the quality of servers you get from an affordable managed WordPress host, like Pantheon, WPEngine or Siteground, this shouldn’t be a concern with any form builder plugin.

So on one hand, you might decrease the complexity of the system for generating your form HTML and your own script to process the form. But you now have to add additional complexity for each additional feature you need. You’re on the hook for anti-spam, new field types, database storage, emails, etc.

I’d be a happier person and a more successful business owner if every time I had the opportunity to pay someone else to do something for me — even though I could do it — in exchange for a small sum of money, I had said yes.

But It’s Just a Simple Form!

So it’s a simple form. Just a few fields. Great. So there is no reason why you can’t install a contact form plugin. If you think something like Caldera Forms or Ninja Forms that can create really complex forms and has all the bells and whistles is too much, Jetpack offers a simple contact form module or you can use Contact Form 7 if you need something very basic.

I can build that basic contact form, using a form template, and place it on a page with Caldera Forms faster than I can think about what file on my site I’d use to write a custom form in. It’s just not a great use of time.

Seriously Josh, How Should I Make My Own Form?

In some cases, I will write a form without using a form plugin for my WordPress site. While Caldera Forms is super powerful and extensible, sometimes what I need to make is more of a web application than anything. When those situations happen I use either React or VueJS and WordPress REST API endpoints. These situations require a pretty complex collection of forms and give me lots of ideas for Connected Forms 2.0.

If you do choose to make your own forms, I would recommend you learn about the existing WordPress REST API endpoints and if you can, use one of those for your form data.

It’s a Free Software

Can you write your own form, without using a plugin? Yes. If you don’t know how, the internet is full of wonderful resources to help you learn how. But before you do, have you considered if it’s worth it? Is doing so making your life easier, and if not, is the trade-off worth it?

I’m probably supposed to say “no, also buy my product” at the end of a blog post like this. Caldera Forms is really powerful, and most of the time, you never need to touch code. And, the run action plugin makes it really easy for developers to use Caldera Forms as an interface and do whatever they want with the submission data.  But, it’s a free software, you should do whatever works best in your unique circumstance — I hope this article helps you evaluate what the best choice for you is.