Categories
WordPress Plugins

Contact Form 7

This post is no longer updated. Move to Contact Form 7 official site.


Download | Plugin Homepage | FAQ | Support Forum

(日本語の説明はこちら)

Summary

screenshot

Just another contact form plugin. Simple but flexible.

  • Supports multiple contact forms.
  • You can customize form and mail contents with simple markup.
  • AJAX submitting with jQuery Form Plugin.
  • Spam filtering with Akismet.
  • Bot prevention with CAPTCHA.

Download and Install

Download the latest release from WordPress.org plugin directory.

  1. Upload whole contact-form-7 folder to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress

Usage

  1. Open admin page [Options] – [Contact Form 7] [Manage] – [Contact Form 7].

    Update: If you are using WordPress 2.7 or greater, you can find the admin page under [Tools] – [Contact Form 7].

  2. Edit default “Contact form 1” or add new and save it.
  3. Copy [contact-form ...] code and paste it into the content of any posts you need the contact form.

FAQ

See Contact Form 7 FAQ

How to customize form and mail contents

You can use “tags” in several fields. Contact Form 7’s “tag” is formed string enclosed in square brackets [].

A tag used in form content is replaced by HTML form control element like <input> or <textarea>.

A tag used in mail template is replaced by user input of element with the same name.

wpcf7-desc

In this picture, a tag [textarea your-message ...] inserted in form content is replaced by <textarea> tag with name="your-message" attribute.

When a visitor input into this <textarea> field and submit, Contact Form 7 generates a mail based on mail template. Since message body field has [your-message] tag, this tag replaced by the user input message.

Tags in form content

You can use the following types of tags in form content.

Type Replaced by Validated as
text <input type="text" /> Any text
text* <input type="text" /> Any text / Required
email <input type="text" /> Email address
email* <input type="text" /> Email address / Required
textarea <textarea> </textarea> Any text
textarea* <textarea> </textarea> Any text / Required
select <select> </select>
select+ <select> </select>
checkbox <input type="checkbox" /> ...
checkbox+ <input type="checkbox" /> ...
radio <input type="radio" /> ...
captchac <img /> CAPTCHA
See How to use CAPTCHA
captchar <input type="text" />
submit <input type="submit" />

The syntax of tag is not so easy. You can use Generate Tag menu under Form textarea to make a tag you need.

I show you some examples of tags.

  • [text your-name 40/100 "John Smith"]

    This tag is replaced with:
    <input type="text" name="your-name" size="40" maxlength="100" value="John Smith" />

  • [email* your-email 60/ id:email]

    <input type="text" name="your-email" id="email" size="60" />

  • [textarea your-message 80x15 "Write message here."]

    <textarea name="your-message" cols="80" rows="15">Write message here.</textarea>

  • [select your-country "China" "India" "other"]
    <select name="your-country">
      <option value="China">China</option>
      <option value="India">India</option>
      <option value="other">other</option>
    </select>

I wrote about tag syntax.

How to use Akismet on Contact Form 7

1. You need Akismet plugin. If you have not activated it yet, activate it first.
2. Open Contact Form 7’s admin page and edit Form text area as:

  • Add akismet:author option to the tag of field which requires sender’s name.
    Example: [text* your-name akismet:author]
  • Add akismet:author_email option to the tag of field which requires sender’s email address.
    Example: [email* your-email akismet:author_email]
  • Add akismet:author_url option to the tag of field which requires sender’s URL.
    Example: [text your-url akismet:author_url]

Once you have activated the Akismet plugin and at least one of the akismet: options is set, Contact Form 7 will send all of a sender’s input as well as any other information related to input activity to the Akismet server. Akismet will then judge whether this input is likely to be spam.

When Akismet judges a message as spam, Contact Form 7 sends no mail and shows a response message with an orange border line (the third example in the picture below).

To make sure the spam filtering is working, send a message with “viagra-test-123” as the sender’s name. If the test is a success, the message will be judged as spam.

Changelog

0.9 (2007/04/30)
Initial release.
1.0 (2007/05/20)
Tag helper.
1.1 (2007/08/02)
File restructuring.
1.2 (2007/08/16)
jQuery Form Plugin introduced.
1.3 (2007/08/26)
New tag type: [select]
1.3.1 (2007/08/26)
Critical bug about JavaScript loading fixed.
1.3.2 (2007/09/03)
Bug fix around jQuery.
1.4 (2007/09/07)
Akismet spam filtering introduced.
1.4.1 (2007/09/11)
Add Spanish and Catalan translations.
1.4.2 (2007/09/13)
Add German translation.
1.4.3 (2007/09/15)
Add Polish translation.
1.4.4 (2007/09/17)
Add French translation.
1.5 (2007/10/07)
CAPTCHA introduced.
1.6 (2007/10/17)
Mail (2) and UI improvement for admin page.
1.6.1 (2007/10/27)
Sidebar widget support.
1.7 (2007/11/27)
New tag type: [select+], [checkbox], [checkbox+] and [radio]
1.7.1 (2007/12/06)
Made wpcf7 variable global. Polish translation updated.
1.7.2 (2007/12/13)
Bugfix. Czech translation added.
1.7.3 (2007/12/23)
New default: and label-first options added.
1.7.4 (2007/12/30)
select+ and checkbox+ tag types removed. multiple and exclusive options added.
1.7.5 (2008/01/26)
Two fixes and include_blank option.
1.7.6 (2008/03/02)
New acceptance tag added.

1,401 replies on “Contact Form 7”

Miyoshi,

Long time since I visit your page! I’m very busy this past few weeks. BTW Its seem you contact form is growing and growing and thats was really great! I’m planing to buy my own domain name this January and I put your contact form 7 on the credits.:) Man I have a little question. Example I have a visitor then she sign up on the contact form and she want a copy of her message that she sent me using checkbox. I hope you understand that.

Thanks!

Hi Jonathan,

Example I have a visitor then she sign up on the contact form and she want a copy of her message that she sent me using checkbox.

You mean “BCC” feature which other plugins have, right? Contact Form 7’s “Mail (2)” feature is like it (you can find it at the bottom of plugin’s admin page), but it always tries to send a copy regardless of checkbox is checked or not. I have a plan to make it possible in the future, but so far it’s not, sorry.

Thanks again for all your wonderful work on this plugin.
I wrote you before about removing the Contact Form 7 code in the head of pages that do not have contact forms.

I’ve employed

within my template (as you instructed in your comment from early December).

It worked on a previous version, but I noticed (with version 1.7.4) that the Contact Form 7 code within the head is NOT removed from pages that do not have the Contact Form.

Am I doing something wrong?

Thanks again!!

Copernicus,

It worked on a previous version, but I noticed (with version 1.7.4) that the Contact Form 7 code within the head is NOT removed from pages that do not have the Contact Form.

This one?

Nothing has been changed around that workaround since 1.7.1. I just confirmed it was still working on my site. I’m not sure but something is wrong.

Dear Miyoshi san,

Just a quick note to say thank you for this wonderful plug-in. I really love it for the all the different features like spam and bot filtering and for having the option to create more than 1 form.

To add to Copernicus’ remark. I tried to remove the code using your suggestion, but it doesn’t seem to work. For your information, I’m on WP 2.3.2.

Anyway thanks again!

Hmm. Indeed there is a problem. I checked the other sites that I’ve employed that code on and it’s not working on them either.

The <HEAD> section still has the link to the CF7 CSS, CDATA bit and link to the .js file on pages that do not have the contact form.

Could it be that something has gone wrong in the copying of
<?php remove_action('wp_head', array(&$wpcf7, 'wp_head')); ?>
…or is that the same code that you’re already using?

I’m sorry to be a bother about this; I hope I’m not overlooking something simple.

As always: thank you!

mmmm, I tested again on WordPress 2.3.2 and Contact Form 7 1.7.4, confirmed it works.

I did:

1. Install WordPress and Contact Form 7,
2. Open default theme’s single.php,
3. Add this code before <?php get_header(); ?>

<?php remove_action('wp_head', array(&$wpcf7, 'wp_head')); ?>

4. Open http://(mysite)/?p=1 (“Hello world!” post) with Firefox and see the HTML source,
5. And confirm that there is NOT a “contact-form-7.js” script line.

Hi Takayuki,
I’m searching to make this plugin working with the last jQuery 1.2.2, but I still have problems: do you have any clue with that?

Many thanks for your plugin!

Hi Paolo,

Thanks for comment. What problem do you have?

I’m using Contact Form 7 on trunk version WordPress and jQuery 1.2.2, but I have no problem.

Dexter,

Thank you for your detailed report. I haven’t known that. I don’t think it is that harmful to SEO, but I’ll consider workarounds.

hi there
dexter, you arouse a good problem…many people are having the same issue and the same concern
This wpcf7=json is not good for SEO since google tend to discard pages with addresses and contents too alike. I use this wonderful plugin and i like it a lot but i am a little concerned since i have about 40 pages with wpcf7=json extension

Awesome plug-in!!

Oddly Subject and Your Message is missing “required”.

See:

And whats the point of using:

Your Site
[text your-url akismet:author_url]

Nothing about the URL is sent in the eamil so whats the point?

Also, any chance you could add a “security” feature?

That is the ability to have the plug-in include with every email for example below. Thanks!

E-Mail Address: ..

Web Site Address: ..

IP Address: ..

Host Name: ..

User Agent: ..

Referral: ..

I too would like to see this great plug-in SEO friendly.

Would also be nice if you could customize those Good, Validation Error, SPAM, and Failed messages without having to edit the source code. ;) Thanks!

Hi,

Whoops, sorry for the spam, did not mean to click submit last time.

One last thing, anyway you could please make it output valid xhtml strict?

Thanks again and hope you had a great weekend!!

Will

Also, the captcha is no longer working. No images are shown, just the text area. Yes it worked fine before the update. So I know I am doing it correctly. :(

Will,

Please read this post first, it explains requirement for using CAPTCHA. And you should make sure that your CAPTCHA tag is used correctly and image file is generated successfully.

Hey i love this little plugin the only bug bear i have is that once you submit a form it clears the form and the confirmation message is at the bottom, why do you not hide the form so the confirmation message is clearly there.

Thanks

Matt

Matthew Hughes,

why do you not hide the form so the confirmation message is clearly there.

I don’t think it’s a simple way for many users, so I won’t fix it. Sorry.

Passengers Only,

Is there a way to (easily) put the text side by side with the input fields? Each goes on top of the field….

You can do it easily. Edit Form field.

You can find Contact Form 7’s admin page on [Options] – [Contact Form 7].

Thanks.

miyoshi

Awesome plugin. I’ve read through the comments and your replies in hopes of solving this.
The plugin is installed and works very well. I have tested it and reconfigured it over and over. Uninstalled and reinstalled it but to no avail…

When I click submit, I receive an email. Except, the body of the email contains [your-message] instead of the content of the form. I assume this is a simple fix that I’m just overlooking. Suggestions?

WP v2.3.3
Gmail

Darren

Darren,

Tag with a name in Mail fields are replaced by user input with the same name. [your-message] will be replaced by [textarea your-message blar blar] tag in Form field.

I hope this will help.

thank you miyoshi for your reply. now i understand that you have already solved the issue on your plgin. As far as google is concerned i am trying to tweaking the robots.txt in order not to index those pages on google. do you think it is a good idea? you know, google penalised my blog heavily and during these last ten days i got 40 visitors less and the count is still dropping drammatically!
give some tips please!

I got captcha up and running on localhost but when I moved to web, the captcha graphic wouldn’t display. What could be the problem?

I already tried removing and installing the plugin via web (instead of just FTPing my localhost) and it still doesn’t work.

Hi,

i want to know if i can use the FORM outside POST or PAGE. I got a if question if visitor is logged or not. if not NO LOOP will run. in that case i got a text right in my phpcode like “fill the FORM and i send you a PASSWORD”. how can i ad the formcode >>>[contact-form 2 "Register"]<<< right in PHP?

cheers
denis

Denis,

[contact-form ......] codes are just placeholders which are expected to be replaced through WordPress’s filters, not for PHP interpreter. Currently they have to be in post/page contents or text widget contents.

If you want to know whether visitor is logged user or not, you can use is_user_logged_in().

Hi,

thanks for the quick reply. I got that with the is_user_logged_in(). I fixed it with a link to a page where the form is.

Thanks a lot
Cheers
denis

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s