Lesson 25 of 50
50% Complete
50%

Contact Forms in WordPress

A contact form allows website visitors to send messages, ask questions, request information or submit enquiries without displaying your email address directly on the page.

Learning Objective: Learn what contact forms are, understand their fields, install a contact form plugin, create a form, add it to a page and test its submission and email delivery.

1. What Is a Contact Form?

A contact form is an online form that collects information from visitors and sends it to a configured destination, such as an administrator's email address or a form-submission database. The available features depend on the form plugin.

Example: Contact Form for Soopro Pathshala

A visitor may use the form to ask about:

  • Computer courses
  • Admission and fees
  • Class timings
  • Online tutorials
  • Technical support

2. Why Do We Need Contact Forms?

Benefits
  • Collect visitor enquiries.
  • Receive course admission questions.
  • Make it easy for customers to contact you.
  • Collect structured information.
  • Support customer service and feedback.
Things to Consider
  • Configure email delivery correctly.
  • Protect forms against spam.
  • Collect only necessary personal information.
  • Test the form before publishing.
  • Protect submitted data appropriately.

3. Common Contact Form Fields

Field Purpose Example
Name Identifies the person contacting you. Rahul Kumar
Email Provides an email address for replies. rahul@example.com
Phone Collects a phone number when necessary. Optional contact number
Subject Describes the reason for the enquiry. Course Information
Message Allows the visitor to explain their request. I want to know about the ADCA course.

4. Popular Contact Form Plugins

WordPress offers several plugins for creating contact forms. Compare their features, maintenance, compatibility and pricing before choosing one.

Contact Form 7

A contact form plugin that supports configurable forms and email notifications.

Suitable for: Basic contact and enquiry forms.

WPForms

Provides a form-building interface with options that depend on the version and plan.

Suitable for: Users who prefer a visual form-building workflow.

Formidable Forms

Provides form creation and more advanced data-oriented features.

Suitable for: More complex forms and data workflows.

Fluent Forms

Offers form-building tools and various integrations depending on the plan.

Suitable for: Contact forms, enquiries and other form workflows.

5. Install a Contact Form Plugin

For this example, we will use Contact Form 7. The same general process applies to many other form plugins, although their settings and form-building methods differ.

Installation Steps
  1. Log in to your WordPress dashboard.
  2. Open Plugins → Add New Plugin.
  3. Search for Contact Form 7.
  4. Review the plugin details and compatibility.
  5. Click Install Now.
  6. Click Activate after installation.
  7. Open the Contact menu or the plugin's form-management screen.
Note: Your dashboard may look different depending on your WordPress version, permissions or hosting plan.

6. Create a Contact Form

After installing a form plugin, create a form with the fields you need. Keep the form simple so visitors can complete it easily.

Example Contact Form Structure
<label> Your Name
    [text* your-name autocomplete:name]
</label>

<label> Your Email
    [email* your-email autocomplete:email]
</label>

<label> Subject
    [text your-subject]
</label>

<label> Your Message
    [textarea your-message]
</label>

[submit "Send Message"]

This is an example of Contact Form 7 form markup. Add it in the form editor provided by Contact Form 7, not in the normal WordPress page editor.

7. Understand the Form Fields

Form Tag Meaning
[text* your-name] Creates a required text field.
[email* your-email] Creates a required email field.
[text your-subject] Creates an optional text field.
[textarea your-message] Creates a message text area.
[submit "Send Message"] Creates the form's submit button.

In Contact Form 7, the asterisk in tags such as [text* your-name] indicates a required field. Choose required fields carefully so you do not request unnecessary information.

8. Configure Email Notifications

Email settings determine where form submissions are sent and what information is included in the notification.

Typical Mail Settings
  • To: The address that receives enquiries.
  • From: A suitable sender address configured for your domain.
  • Subject: A recognizable email subject.
  • Message Body: The fields included in the notification.
  • Reply-To: The visitor's email address, when correctly configured and validated.
Important Email Tip: Use a sender address authorized for your domain. Do not put a visitor's email address in the sender field as if your server owned that address. Configure Reply-To with the visitor's submitted email when appropriate, and test actual delivery.

9. Add a Contact Form to a WordPress Page

After creating a form, place it on your Contact page so visitors can use it.

Steps to Add the Form
  1. Open the form-management screen in Contact Form 7.
  2. Copy the form's shortcode.
  3. Open Pages → Add New Page, or edit an existing Contact page.
  4. Enter a title such as "Contact Us".
  5. Add the shortcode using a Shortcode block, or use the plugin's recommended insertion method.
  6. Preview the page.
  7. Publish or update the page.
Example Shortcode
[contact-form-7 id="123" title="Contact form"]

This is only an example. Replace the ID and title with the shortcode generated for your actual form.

10. Test Your Contact Form

A form can appear correctly on a page but still fail to deliver messages. Always test both form submission and email delivery.

Contact Form Testing Checklist
  • ☐ Required fields cannot be left empty.
  • ☐ Email validation works correctly.
  • ☐ The submit button works.
  • ☐ Success and error messages appear correctly.
  • ☐ The notification reaches the configured inbox.
  • ☐ Replies can be sent to the visitor when appropriate.
  • ☐ The form is usable on mobile devices.

11. Protect Forms from Spam

Public forms can receive unwanted or automated submissions. Use suitable protection while keeping the form accessible to genuine visitors.

Recommended Measures
  • Use supported anti-spam integrations.
  • Enable appropriate validation.
  • Use rate limiting where suitable.
  • Keep WordPress and plugins updated.
  • Monitor suspicious submissions.
Avoid These Mistakes
  • Collecting unnecessary sensitive information.
  • Using untrusted form add-ons.
  • Ignoring repeated spam submissions.
  • Assuming form submission guarantees email delivery.
  • Publishing a form without testing it.

12. Common Contact Form Problems

Problem Possible Cause What to Check
Email is not received Mail configuration or server delivery issues. Check spam folders, plugin messages and SMTP configuration.
Form does not submit JavaScript errors, validation problems or conflicts. Check browser errors and test plugin compatibility.
Spam submissions Automated bots or public form abuse. Review validation and supported anti-spam protection.
Form does not appear Incorrect shortcode or editor placement. Copy the correct shortcode and inspect the page.
Mobile layout looks broken Theme styles or conflicting CSS. Preview on mobile and inspect the relevant styles.

13. Practical Assignment

Activity: Create a Contact Page

Use a WordPress test or development website to complete these tasks:

  1. Install and activate a trusted contact form plugin.
  2. Create a form with name, email, subject and message fields.
  3. Configure the email notification settings.
  4. Create a page named "Contact Us".
  5. Insert the form using the plugin's supported method.
  6. Add your institute's contact information to the page.
  7. Submit a test enquiry and confirm delivery.
  8. Check the form on mobile and desktop screens.

Challenge: Create an enquiry form for Soopro Pathshala that asks visitors which course they are interested in, while collecting only the information needed to respond.

Lesson Summary

  • A contact form collects messages and enquiries from visitors.
  • Plugins provide tools for creating and managing forms.
  • Contact Form 7 supports form tags and shortcodes.
  • Email notifications must be configured and tested.
  • Spam protection and careful data collection are important.
  • Always test the form on desktop and mobile devices.

Lesson 25 Quiz

Choose the correct answer for each question.

Q1. What is the main purpose of a contact form?
Q2. What is a shortcode used for in Contact Form 7?
Q3. What should you do after creating a contact form?