WordPress
Published: 27-Jul-2026

How to Create a Contact Form in WordPress Without a Plugin

Skip Contact Form 7 and WPForms. Embed a lightweight HTML form in a WordPress page or theme and route submissions to a cloud form backend — no plugin maintenance.

MFC

MyFormConnect Team

WordPress contact form plugins are convenient to install, but they accumulate quickly. Contact Form 7, WPForms, Gravity Forms — each adds admin screens, database tables, JavaScript on every page load, and another item on your update list. This guide shows how to add a working contact form to WordPress without any plugin, using a custom HTML block and an external form endpoint.

Why plugins cause problems over time

Form plugins are one of the most common sources of plugin-related security issues in WordPress. Each plugin extends the attack surface, adds code that runs on every page load (even pages without a form), and requires ongoing updates. Abandoned plugins become a genuine security risk.

Beyond security, plugin forms often produce markup that conflicts with your theme CSS, and migrating to a new theme or host can break form styling or configuration unexpectedly.

Method 1: Custom HTML block in the block editor

This is the quickest approach and works without touching any theme files.

  1. In your WordPress admin, open the page where the form should appear
  2. Click the + button to add a block, and search for Custom HTML
  3. Paste the form HTML below into the block
  4. Update the page and test the form
<form action="https://myformconnect.io/f/YOUR_FORM_ID" method="POST" class="contact-form">

  <p>
    <label for="cf-name">Name</label><br />
    <input id="cf-name" name="name" type="text" required style="width:100%; padding:0.5rem;" />
  </p>

  <p>
    <label for="cf-email">Email address</label><br />
    <input id="cf-email" name="email" type="email" required style="width:100%; padding:0.5rem;" />
  </p>

  <p>
    <label for="cf-message">Message</label><br />
    <textarea id="cf-message" name="message" rows="6" required style="width:100%; padding:0.5rem;"></textarea>
  </p>

  <input type="hidden" name="_redirect" value="https://yoursite.com/thank-you" />

  <p><button type="submit">Send message</button></p>

</form>

The inline styles above are a starting point. Replace them with your theme's CSS classes once you've confirmed the form works.

Method 2: Template part in a child theme

If you want the form to appear consistently across multiple pages, or you want it in a location the block editor doesn't reach (sidebar, footer), add it as a template part.

Create a file in your child theme at template-parts/contact-form.php:

<?php /* template-parts/contact-form.php */ ?>

<form action="https://myformconnect.io/f/YOUR_FORM_ID" method="POST" class="contact-form">
  <label for="cf-name">Name</label>
  <input id="cf-name" name="name" type="text" required />

  <label for="cf-email">Email</label>
  <input id="cf-email" name="email" type="email" required />

  <label for="cf-message">Message</label>
  <textarea id="cf-message" name="message" rows="6" required></textarea>

  <input type="hidden" name="_redirect" value="https://yoursite.com/thank-you" />

  <button type="submit">Send message</button>
</form>

Then include it in any template file with:

<?php get_template_part('template-parts/contact-form'); ?>

Always use a child theme — changes to a parent theme are overwritten on updates.

Method 3: Page builder HTML widget

If you're using Elementor, Divi, Bricks, or a similar builder, look for an HTML or Raw HTML widget. Paste the form HTML directly. The builder treats it as a custom code block and renders it without modification.

Styling the form to match your theme

Rather than inline styles, use your theme's existing CSS classes. Most WordPress themes style <input>, <textarea>, and <button> elements globally. If the default styling doesn't fit, add a class to the form and write targeted CSS in your child theme's style.css or via Appearance → Customise → Additional CSS.

Spam protection without Akismet

Akismet (the default WordPress anti-spam plugin) works for comments, but doesn't protect external form endpoints. Enable spam protection in the MyFormCapture form settings instead — it applies honeypot, timing, and content scoring checks at the endpoint level before a submission reaches your dashboard.

For high-traffic or public-facing forms, see how to stop contact form spam without a backend.

Is it worth removing the plugin?

If you're running a form plugin that works and you update WordPress regularly, switching isn't urgent. But if you're installing a new WordPress site, or you're already trimming plugin count for performance or security reasons, a plain HTML form with an external endpoint is a straightforward replacement with fewer moving parts.

You keep full control of the form markup, you're not dependent on a plugin developer maintaining compatibility with the current WordPress version, and spam protection improves because it runs server-side on the endpoint rather than relying solely on Akismet.

Ready to collect form submissions?

Create a free MyFormCapture form endpoint and skip building your own backend.

Start Free Trial

No credit card required · 5-minute setup