Skip to content

WPConstructor/contact

Repository files navigation

WPConstructor Contact

WPConstructor Contact Logo

A lightweight WordPress contact form plugin that provides a simple shortcode-based contact form with customization options, optional Google reCAPTCHA v3 support, AJAX form submission, persistent form input storage, and submission rate limiting.


Features

  • Simple contact form via shortcode
  • Fields: Name, Email, Subject, Message
  • Customizable field labels
  • Custom CSS injection via shortcode
  • AJAX form submission (no page reload required)
  • Optional Google reCAPTCHA v3 integration
  • Configurable recipient email address
  • Stores entered form data locally so it is preserved on page reload
  • 5-minute submission cooldown to prevent spam/flooding
  • Lightweight and fast

Installation

  1. Download the WPConstructor Contact plugin ZIP at WPConstructor Contact Release
  2. Go to your WordPress Admin Panel
  3. Navigate to Plugins → Add New
  4. Click Upload Plugin
  5. Select the ZIP file and install it
  6. Activate the plugin
  7. (Optional) Configure constants in wp-config.php (see Configuration section)
  8. Add the contact form shortcode to any page or post:
[wpcn_contact]

Usage

Basic shortcode

[wpcn_contact]

This displays a contact form with default labels.


Custom field labels

You can customize labels using shortcode attributes:

[wpcn_contact 
 name="Your Name"
 email="Your Email"
 subject="Subject"
 message="Message"]

Custom CSS

You can inject custom styles using the css attribute:

[wpcn_contact css=":root {--wpcn-contact-font-size: 18px;}"]

Useful selectors

  • .wpcn-contact-form input – input fields
  • .wpcn-contact-form textarea – message field
  • .wpcn-contact-form button – submit button
  • #wpcn-contact-result – message output container
  • #wpcn-contact-result.wpcn-contact-success – success message
  • #wpcn-contact-result.wpcn-contact-error – error message
  • #wpcn-contact-result.wpcn-contact-info – info message

AJAX Submission

The form uses AJAX to submit data asynchronously without refreshing the page.

Benefits

  • No page reload after submission
  • Faster user experience
  • Better UX feedback handling
  • Seamless integration with themes

Behavior

  • Form data is sent via background request
  • Success or error messages are displayed dynamically
  • Form fields remain intact unless submission succeeds

Submission Cooldown (Anti-Spam Feature)

To prevent spam and repeated submissions, the plugin enforces a 5-minute cooldown per user.

How it works

  • After a successful submission, the user must wait 5 minutes before submitting again
  • Submissions during cooldown are blocked
  • An informational message is shown via:
#wpcn-contact-result.wpcn-contact-info

Purpose

  • Prevents spam flooding
  • Reduces server load
  • Improves email deliverability
  • Protects against bot abuse

Data Persistence Feature

The plugin automatically stores form input values in the browser.

What this means:

  • If a user refreshes the page
  • Or accidentally navigates away and returns

Their entered data (Name, Email, Subject, Message) will still be present.


Configuration (wp-config.php)

Change recipient email

By default, messages are sent to the WordPress admin email.

define('WPCN_CONTACT_EMAIL_TO', 'your-email@example.com');

Enable Google reCAPTCHA v3

define('WPCN_RECAPTCHA_SITE_KEY', 'YOUR_GOOGLE_SITE_KEY');
define('WPCN_RECAPTCHA_SECRET_KEY', 'YOUR_GOOGLE_SECRET_KEY');

Once enabled, form submissions are protected by Google reCAPTCHA v3.


Shortcode Reference

Attribute Description Example
name Label for Name field name="Your Name"
email Label for Email field email="Your Email"
subject Label for Subject field subject="Topic"
message Label for Message field message="Your Message"
css Custom CSS injection css="input {font-size:16px;}"

Form Behavior

  • Sends email submissions to configured recipient
  • Uses WordPress mail system
  • Displays success/error/info messages dynamically (AJAX)
  • Preserves user input across page reloads
  • Enforces 5-minute submission cooldown per user
  • Optional spam protection via reCAPTCHA v3

Troubleshooting

Emails not sending

  • Check WordPress mail configuration
  • Verify recipient email constant

Form not submitting via AJAX

  • Ensure JavaScript is enabled
  • Check for theme or plugin script conflicts
  • Disable caching/minification temporarily

Form blocked due to cooldown

  • Wait 5 minutes before submitting again
  • Check browser storage if testing repeatedly

Form not saving data on reload

  • Ensure JavaScript is enabled in the browser
  • Check for caching conflicts

reCAPTCHA not working

  • Verify both keys are correctly set in wp-config.php
  • Ensure domain is registered in Google reCAPTCHA console

License

WPConstructor Contact is released under GPL 3.0 or later licensing terms. See LICENSE.md for details.


Plugin Info

  • Name: WPConstructor Contact
  • Version: 0.4
  • Type: WordPress Plugin

About

WPConstructor Contact is a lightweight WordPress plugin that adds a customizable AJAX contact form with reCAPTCHA support, input persistence, and a 5-minute submission cooldown for spam protection.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors