Skip to content
Jetpack

Individual products

Security
VaultPress Backup Scan Akismet Anti-spam
Performance
Site Search Boost VideoPress
Growth
Stats Social Newsletter SEO Blaze CRM
Management
Manage Mobile App

Product Bundles

Pro Security, performance, and growth tools for your WordPress site. Complete The full Jetpack suite with higher service limits.
Pricing
Overview What Jetpack AI does for your site Skills WordPress superpowers for your agent Docs Connect and set up your AI agent Getting started Connect ChatGPT, Claude or a coding agent Compare Jetpack vs other WordPress MCP connectors

Connect your agent. It’s free.

Connect ChatGPT or Claude and let it run your site, with no paid plan needed.

Get it for ChatGPT (opens in a new tab) Or use Claude (opens in a new tab)
Support Guides and help from our team Docs How-to guides for every Jetpack feature Feature Requests Request features and vote on ideas Blog News, product updates, and how-tos
About
Sign in Get Started
Security
VaultPress Backup Scan Akismet Anti-spam
Performance
Site Search Boost VideoPress
Growth
Stats Social Newsletter SEO Blaze CRM
Management
Manage Mobile App

Product Bundles

Pro Complete
Pricing
Overview What Jetpack AI does for your site Skills WordPress superpowers for your agent Docs Connect and set up your AI agent Getting started Connect ChatGPT, Claude or a coding agent Compare Jetpack vs other WordPress MCP connectors

Connect your agent. It’s free.

Connect ChatGPT or Claude and let it run your site, with no paid plan needed.

Get it for ChatGPT (opens in a new tab) Or use Claude (opens in a new tab)
Support Guides and help from our team Docs How-to guides for every Jetpack feature Feature Requests Request features and vote on ideas Blog News, product updates, and how-tos
About Search
Sign in Get Started

Blog / Developers

Hook of the Month: Customizing Contact Forms

Jeremy Herve's avatar

Jeremy Herve March 18, 2016 · 1 min read


Did you know you could create contact forms with Jetpack? This month, we’ll discover different ways to customize these forms on your site.

Jetpack Subscriptions

Change the post-submission success message

Would you like to thank your readers after they submit a form on your site? Maybe you want to let them know that you’ll be in touch soon or maybe you want to confirm that their email address has been added to a raffle.

The grunion_contact_form_success_message filter allows you to specify a custom success message on each one of the forms on your site. In the example below, I’ve defined 2 custom success messages:

  • The first one is only displayed on the form displayed on page ID 1471.
  • The second appears on all other forms, and replaces Jetpack’s default success message.
function jetpackcom_contact_confirmation() {
	if ( is_page( '1471' ) ) {
		$conf = __( 'A special confirmation message for the form you added to page 1471', '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

Better than a custom success message, you can redirect your readers to a specific page on your site. As soon as they click the submit button, they can be redirected to a page of your choosing. For example, readers could be redirected to a page where they can claim a prize after giving you their contact information.

To create that redirection, we’ll use the grunion_contact_form_redirect_url filter. This filter allows us to set different redirection URLs for each form on your site.

/**
 * 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 “Required” label

By default, Jetpack will display a “Required” text next to form fields that your readers are required to fill in before they can submit a form:

Required Jetpack form field

Sometimes, you might want to change “Required” into something else. That’s where the jetpack_required_field_text filter comes in:

 function jetpackcom_custom_required() {
 	return __( 'This is important, you must fill it in.', 'plugin-textdomain' );
 }
 add_filter( 'jetpack_required_field_text', 'jetpackcom_custom_required' );
 

The Contact Form module includes more than 20 other hooks in addition to the ones mentioned above. Check the code to learn more. You can also visit our support page to discover some of the other options available for customizing the contact form.

Do you want to dive deeper into Jetpack, and discover other useful hooks to help you customize Jetpack? Make sure to follow this blog and discover a new hook each month!

Like Loading…
Jeremy Herve's avatar

Written by

Jeremy Herve

WordPress, TV Series, music, kids, and board games. I think that's probably the best way to define me in a few words. 🙂 I work at Automattic where I lead a team building tools for bloggers and creators. I talk a lot about WordPress things, but also about all things open source in general. I live in Brittany, France, so you'll also find me sharing pictures from our beautiful region from time to time.

Explore the benefits of Jetpack

Learn how Jetpack can help you protect, speed up, and grow your WordPress site.

Explore plans

Questions about this post? Ask in the support forum

Share


Keep reading.

More from Developers, newest first.

See all posts

Developers Sep 2, 2026

Jetpack 16.1.3: Critical Security Update

Yesterday we released a new version of Jetpack, 16.1.3. This release contains a critical security update. While we have no evidence that this vulnerability has been…

Brandon Kraft's avatar Brandon Kraft 2 min read

Developers Mar 5, 2026

How to Install WordPress on XAMPP + a Better Alternative

Learn how to install WordPress on XAMPP step by step, plus compare it to a modern alternative built specifically for WordPress developers.

Jen Swisher's avatar Jen Swisher 8 min read

Developers Mar 3, 2026

How to Install WordPress on a Subdomain (Step-by-Step Guide)

Complete setup guide: How to create one in your host, point DNS, secure your site, and configure key settings. Plus, how subdomains impact your SEO.

Jen Swisher's avatar Jen Swisher 7 min read

Run your WordPress site the AI-first way.

Free to start, and AI agents are free to connect. Money back within 14 days on yearly plans.

Get Started Get Jetpack free

WordPress Plugins

  • Akismet Anti-spam↗ (opens in a new tab)
  • Jetpack↗ (opens in a new tab)
  • Jetpack Boost↗ (opens in a new tab)
  • Jetpack CRM↗ (opens in a new tab)
  • Jetpack Protect↗ (opens in a new tab)
  • Jetpack Search↗ (opens in a new tab)
  • Jetpack Social↗ (opens in a new tab)
  • Jetpack VideoPress↗ (opens in a new tab)
  • VaultPress Backup↗ (opens in a new tab)
  • WP Super Cache↗ (opens in a new tab)
  • Download

AI

  • Jetpack AI
  • Skills
  • WordPress MCP

Partners

  • Partner Program
  • Recommended Hosts
  • For Hosts
  • For Agencies
  • For Affiliates

Developers

  • Documentation↗ (opens in a new tab)
  • Beta Program
  • Jetpack on GitHub↗ (opens in a new tab)

Help

  • Knowledge Base
  • Forums↗ (opens in a new tab)
  • Reviews and Testimonials
  • Contact Us
  • About Jetpack
  • Press
Select language English
  • English
  • Deutsch
  • Español
  • Français
  • 日本語

© 2026 Automattic Inc. All rights reserved.

  • Terms of Service↗ (opens in a new tab)
  • Privacy Policy↗ (opens in a new tab)
  • GDPR

Made with care by

Download on the App Store Get it on Google Play
Loading Comments...
  • Reblog
  • Subscribe Subscribed
    Jetpack
    Join 53,355 other subscribers

    Have a WordPress.com account? Log in now.

  • Jetpack
    Copy shortlinkView post in Reader
    Manage subscriptionsSign upLog in
    Report this content
    Collapse this bar
%d