Support Home > Utilities > WordPress Contact Form

WordPress Contact Form

A contact form is a great way to offer your readers the ability to get in touch, without giving out your personal email address.

This module is now enabled by default. If you do not see the functionality described below, please visit Control Jetpack’s Modules on One Page to learn how to activate it.

Create a contact form

You can add a contact form to any post or page. To get started, click the contact form icon above the post editor. Note: you can only have one contact form per page.

Add a Contact Form

The form will be inserted directly into your content:

inserted form

 

Handling the form results

You will receive an email notification for each contact form response. All responses will be listed in the Feedback section of your WordPress Admin.

Click on the form and choose the pencil icon to edit it:

edit form

There, you can adjust all of the form’s settings, including the email address it’s sent to, the subject of the all, and all form fields and types:

edit form settings

If you have the Akismet plugin installed and activated and have an active subscription, every form submission will be checked for spam.

embedded form

Customize the Submit button

Once you’ve inserted a contact form into one of your posts or pages, you can customize the title of the Submit button by adding a submit_button_text parameter to the shortcode, like so:

[contact-form submit_button_text='YOUR CUSTOM SUBMIT BUTTON TEXT HERE'][contact-field label='Name' type='name' required='1'/][contact-field label='Email' type='email' required='1'/][contact-field label='Website' type='url'/][contact-field label='Comment' type='textarea' required='1'/][/contact-form]

Tips for using your form

  • Add to Pages, Posts, or Widgets – Contact forms can be added to pages or posts, or if you copy the generated code, you can add your contact form to a text widget.
  • Forms are customizable – Contact forms can be customized. You can add and remove fields, choose which fields are required, change the email address, or change the subject settings. The form’s appearance can be further customized with CSS.
  • Edit an existing form – To edit an existing form, edit the post or page from WP Admin, then click “Add Contact Form.”
  • One per page – Each post, page, and text widget will only display one contact form.
  • Remember, email is not secure – Do not use contact forms for sensitive information like credit card numbers, as the information will be transmitted by email.
  • Built-in spam filter – We filter submissions through Akismet to fight spam, then add them to your feedback menu, which is accessible to Editors and Administrators on your site. We also email a copy to you.

Change the post-submission success message

If you like, you can show a custom message after your form has been submitted. The grunion_contact_form_success_message filter allows you to specify a custom success message on each one of the forms on your site.

The sample code below allows you to customize the message for a form added to a specific page as well as define a generic message for all other forms.

function jetpackcom_contact_confirmation() {
	if ( is_page( '10' ) ) {
		$conf = __( 'A special confirmation message for the form you added to page 10', 'plugin-textdomain' );
	} else {
		$conf = __( 'A generic confirmation message to display for all the other forms', 'plugin-textdomain' );
	}
	return $conf;
}
add_filter( 'grunion_contact_form_success_message', 'jetpackcom_contact_confirmation' );
 

Redirect readers to a specific page after submission

If you want, you can redirect your readers to a specific page on your site after submitting the form. For example, readers could be redirected to a page where they can claim a prize after providing you with their contact information.

To create that redirection, we’ll use the grunion_contact_form_redirect_url filter:

/**
 * Jetpack Contact Form Custom Redirections.
 *
 * @param  string $redirect Post submission URL.
 * @param  int    $id       Contact Form ID.
 * @param  int    $post_id  Post ID.
 *
 * @return string $redirect Custom Post submission URL.
 */
function jetpackcom_custom_form_redirect( $redirect, $id, $post_id ) {
	/**
	 * Create a list of pages where you've inserted forms.
	 * For each contact Form ID (found via the id attribute on the form),
	 * set up a custom URL where the user will be redirected.
	 */
	$redirects = array(
		'1370' => home_url( 'page_on_your_site' ),
		'2239' => home_url( 'another_page' ),
		'1370' => home_url( 'page_on_your_site' ),
	);

	// Let's loop though each custom redirect.
	foreach ( $redirects as $origin => $destination ) {
		if ( $id == $origin ) {
			return $destination;
		}
	}

	// Default Redirect for all the other forms.
	return $redirect;
}
add_filter( 'grunion_contact_form_redirect_url', 'jetpackcom_custom_form_redirect', 10, 3 );
 

Customize the Notification emails

Jetpack’s Form Builder allows you to customize the fields you add to the contact form, and also offers an option to change the subject of the email sent to you after each form submission.

You can add tokens to the subject field, like {city}, and Jetpack will replace the token with the value of the “City” form field (case insensitive, just make sure that the words match).

I don’t see the form interface, I only see code!

If you don’t see the form interface described above, make sure that you’re in the editor’s Visual tab and not the Text tab, from the top-right of the editor.

If you don’t see the Visual and Text tabs as described, go to Users > Your Profile in your site’s Dashboard and uncheck “Disable the visual editor when writing.”

The form interface will only work in the editor’s Visual tab.

I’m not receiving notification emails about my form submissions!

Jetpack, like other contact form plugins, uses a function named wp_mail() to send out emails. It’s the same function that is used by WordPress to send you comment notifications, or notifications about new users registering on your site.

You can check if that function works properly by leaving a comment on your site and checking if you receive an email. Another alternative would be to use the Email Logs plugin. This plugin records a log of all e-mails sent out by WordPress once it is activated. If an email is listed in this plugin’s logs and you do NOT receive it, then the issue is likely either with your server or the recipient’s server.

If you find issues with that function, you could use an SMTP plugin to configure your WordPress installation to use a specific email service to send out emails.

If the function appears to be work properly, it means that Jetpack’s emails are being filtered out before they can reach your inbox. A few possibilities:

  • They can be filtered out by your server before they even get sent out. Your hosting provider should be able to check their server email logs to find out if the emails were blocked.
  • They can be filtered out by your email provider. If you don’t find the emails in your spam folder, you’ll want to try sending out Jetpack emails to another email address, and see if you keep experiencing issues.

If none of this helps, contact support for assistance.

  • Table Of Contents

  • Categories

  • Contact Us

    Need more help? Feel free to contact us.