---
title: "How to Create a Contact Form in WordPress (With and Without a Plugin)"
url: https://nexterwp.com/blog/how-to-create-a-contact-form-in-wordpress/
date: 2026-07-16
modified: 2026-07-16
author: "Aditya Sharma"
description: "Learn how to create a contact form in WordPress two ways: with a no-code form block, or without a plugin using an HTML form and a PHP handler, plus how to make sure it actually sends email."
image: https://nexterwp.com/wp-content/uploads/2026/07/t4pfx2-1024x538.jpg
word_count: 1511
---

# How to Create a Contact Form in WordPress (With and Without a Plugin)

#### Key Takeaways
- For almost every WordPress site, a form block or plugin is the right call. You get spam protection, saved submissions, and email notifications without writing any code.- The Nexter Blocks Form Builder builds a contact form visually inside the block editor, with fields for name, email, phone, message, dropdowns, checkboxes, and a built-in security code.- You can build a form without a plugin using an HTML form plus a small PHP handler, but you give up spam filtering, stored entries, and easy email deliverability.- Most "my contact form is not emailing me" problems are email delivery issues. Connecting SMTP fixes them.- Before you go live, add spam protection, mark your required fields clearly, and include a consent checkbox.

 

You have finished your WordPress site, and the one thing standing between you and your first enquiry is a working contact form. The question is how to build it. Do you reach for a plugin, drop in a block, or hand-code the whole thing yourself?

All three routes work. They do not all cost you the same amount of time, and they do not all protect you from spam or lost messages equally. This guide walks through two practical ways to create a contact form in WordPress, with a plugin and without one, and helps you pick the method that fits your site before you build.

![Nexter Blocks Form Builder for WordPress showing form field types](https://nexterwp.com/wp-content/uploads/2026/07/ms9knL-NSQEUguysOy2stuulqpAGMxkWh065uvr-Wyhdz02IBpVO2vZpPw-Cc-yGmAWZfLjz6AN3-5MxxuXV7g-scaled.png)The Nexter Blocks Form Builder lets you assemble a contact form field by field inside the WordPress block editor.

Table of Contents

## Do You Even Need a Plugin? Which Method to Pick

Here is the short answer most tutorials skip. A form block or plugin is the right choice for almost everyone. It handles the three things a raw HTML form does not: it stops spam, it stores every submission inside WordPress so a lost email does not mean a lost lead, and it sends notification emails for you.

Build a form without a plugin only when you have a specific reason: you want zero extra code loading on the page, you are comfortable editing theme files, and you can accept that you will handle spam and email delivery yourself. If that does not describe you, use a block. Here is how each method actually works.

## Method 1: Create a Contact Form With a Block (No Code)

The fastest path is a block that builds the form for you inside the editor you already use. Nexter Blocks includes a [Form Builder](https://nexterwp.com/nexter-blocks/builder/wordpress-form-builder/) that does exactly this. The base [Nexter Blocks](https://nexterwp.com/nexter-blocks/) collection is a set of Gutenberg blocks that is free on WordPress.org, and the Form Builder sits in the Pro tier. Here is the flow.

- Open the page or post where you want the form, then add a new block and search for the Form Builder block.- Add your fields. The Form Builder supports Name, Email Address, Phone Number, Message, Dropdown, Radio Button, Checkbox, Numeric Input, a date picker ("Pick a Date"), a time picker ("Pick a Time"), Website URL, Hidden Fields, an "Agree to Terms" checkbox, and a Security Code field for spam.- Mark the fields people must complete as required. For a standard contact form, that is usually name, email, and message.- Set where submissions should be emailed and, if you want, a confirmation message the visitor sees after they submit.- Publish the page and send yourself a test message.

That covers the whole job without a single line of code. The Security Code field is your first line of defense against bots, and because the form is a native block, it inherits your theme styling instead of looking like a bolted-on widget.

![Nexter Blocks free WordPress Gutenberg blocks library](https://nexterwp.com/wp-content/uploads/2026/07/WhT1Gob7jylbQhMJNyW7aS2Euw-wMXhHqzKtn-1URfkA9C7sVHDDG0mKqjaAu0zZeymJt78imSluL1IMqpAMQw-scaled.png)Nexter Blocks is a free Gutenberg block collection on WordPress.org; the Form Builder is part of its Pro tier.

***Also Read:** [5 Best WordPress Contact Form Plugins](https://nexterwp.com/blog/wordpress-contact-form-plugins/) if you want to compare dedicated form plugins before you settle on one.*

## Method 2: Create a Contact Form Without a Plugin

WordPress does not ship with a native contact form block, so building one without a plugin means two pieces: an HTML form on the page, and a small piece of PHP that receives the submission and emails it to you. This is genuinely more work, and you take on jobs a plugin would do for you, so read the trade-offs at the end of this section before you commit.

First, add a Custom HTML block to your page and paste a basic form. It points at WordPress's built-in `admin-post.php` handler:

`<form action="/wp-admin/admin-post.php" method="post">
<input type="hidden" name="action" value="my_contact_form">
<p><label>Name<br><input type="text" name="cf_name" required></label></p>
<p><label>Email<br><input type="email" name="cf_email" required></label></p>
<p><label>Message<br><textarea name="cf_message" required></textarea></label></p>
<button type="submit">Send</button>
</form>`

Next, add the handler to your child theme's `functions.php` file (use a child theme so a theme update does not wipe it). This example sanitizes the input, sends the email with WordPress's own `wp_mail()` function, and redirects back:

`function handle_my_contact_form() {
$name = sanitize_text_field( $_POST['cf_name'] );
$email = sanitize_email( $_POST['cf_email'] );
$message = sanitize_textarea_field( $_POST['cf_message'] );

$to = get_option( 'admin_email' );
$subject = 'New contact form message from ' . $name;
$body = "From: $name ($email)\n\n$message";
$headers = array( 'Reply-To: ' . $email );

wp_mail( $to, $subject, $body, $headers );
wp_safe_redirect( home_url( '/thank-you/' ) );
exit;
}
add_action( 'admin_post_my_contact_form', 'handle_my_contact_form' );
add_action( 'admin_post_nopriv_my_contact_form', 'handle_my_contact_form' );`

That is a working contact form with no plugin. Be honest with yourself about what it does not do, though. It has no spam protection, so expect bot submissions unless you add a nonce and a CAPTCHA yourself. It does not store submissions anywhere, so if the email fails to arrive, the message is gone. And `wp_mail()` depends on your server being able to send mail, which many hosts do not do reliably. That last problem is common enough that it deserves its own section.

***Also Read:** [How to Create a Donation Form in WordPress](https://nexterwp.com/blog/how-to-create-a-donation-form-in-wordpress/) if your form needs to collect payments, not just messages.*

## Make Sure Your Form Can Actually Send Email

The single most common contact form complaint is not a broken form. It is a form that submits fine but never emails you. By default WordPress sends mail through the server's PHP mail function, which spam filters distrust, so messages land in spam or vanish entirely.

The fix is to send through authenticated SMTP instead. Nexter Extension includes an SMTP Email Setup utility that connects WordPress to a proper mail service, alongside Captcha Spam Protection with Google reCAPTCHA integration for the form itself. Nexter Extension is paid, with a 60-day money-back guarantee, and a dedicated SMTP plugin will do the same job if you prefer a single-purpose tool. Whichever route you take, set up SMTP and send a test before you trust the form with real leads.

![Nexter Extension SMTP email setup and security features](https://nexterwp.com/wp-content/uploads/2026/07/ZXckMM0UF5pFquKTPls0iLg3i4TEQR0DyB_ce8-tvGjETk5YoncZBf16QP90t2plABZBj8AsH-AFGlmOhucU6w-scaled.png)Nexter Extension bundles an SMTP Email Setup utility and reCAPTCHA spam protection, the two pieces a bare form is missing.

***Also Read:** [How to Fix WordPress Not Sending Emails](https://nexterwp.com/blog/how-to-fix-wordpress-not-sending-email/) for the full walkthrough on diagnosing delivery problems.*

## Contact Form Best Practices

However you build the form, a few habits separate a form that generates leads from one that generates headaches:

- **Keep it short.** Name, email, and message are enough for a general contact form. Every extra field lowers the number of people who finish it.- **Add spam protection.** A CAPTCHA, a security-code field, or an SMTP service with filtering keeps your inbox clean.- **Mark required fields clearly** so visitors are not guessing what they missed.- **Respect consent.** If you are in a region covered by GDPR or similar rules, add a consent checkbox explaining how you use the data.- **Confirm the submission.** Show a thank-you message or redirect to a confirmation page so people know the message went through.- **Send yourself a test** from an outside email address after every change.

## Frequently Asked Questions

### Can you create a contact form in WordPress without a plugin?

Yes. You add an HTML form to a page with a Custom HTML block and handle the submission with a small PHP function in your child theme that calls `wp_mail()`. It works, but you take on spam protection, submission storage, and email deliverability yourself, which is why most sites use a form block instead.

### Why is my WordPress contact form not sending emails?

Almost always because WordPress is using the server's default PHP mail, which spam filters block. Connecting an authenticated SMTP service, such as the SMTP Email Setup in Nexter Extension or a dedicated SMTP plugin, resolves it in most cases.

### Does WordPress have a built-in contact form block?

No. Core WordPress does not include a native contact form block, so you need either a form block from a blocks collection like Nexter Blocks, a dedicated form plugin, or a hand-coded HTML form with a PHP handler.

### How do I stop spam on my contact form?

Add a CAPTCHA or a security-code field, keep a honeypot or nonce on custom forms, and route mail through an SMTP service that filters. The Nexter Blocks Form Builder has a Security Code field, and Nexter Extension adds Google reCAPTCHA.

## Suggested Reading

- [5 Best WordPress Contact Form Plugins](https://nexterwp.com/blog/wordpress-contact-form-plugins/)- [How to Fix WordPress Not Sending Emails](https://nexterwp.com/blog/how-to-fix-wordpress-not-sending-email/)- [How to Set Up WordPress Email Notifications](https://nexterwp.com/blog/how-to-set-up-wordpress-email-notifications/)- [How to Embed Google Maps in a WordPress Contact Form](https://nexterwp.com/blog/embed-google-maps-in-wordpress-contact-form/)- [How to Create a Donation Form in WordPress](https://nexterwp.com/blog/how-to-create-a-donation-form-in-wordpress/)

#### Stay updated with Helpful WordPress Tips, Insider Insights, and Exclusive Updates – Subscribe now to keep up with Everything Happening on WordPress!

Subscribe