WP-Contact Form 7 — PHP

I don’t know how much information you need for this, but WP-ContactForm-7 is a contact form for WordPress. By default it has one server response message for all forms on the website. I have multiple forms and would like a different server response messages for each one.

How can I create different server response messages for each different form that I create with this plugin?

Read More

Following is the snippet of PHP code from the plugin that seems to relate to the messages the contact form displays:

function message($status) {
    switch ($status) {
        case 'mail_sent_ok':
            return __('Your message was sent successfully. Thanks.', 'wpcf7');
        case 'mail_sent_ng':
            return __('Failed to send your message. Please try later or contact administrator by other way.', 'wpcf7');
        case 'validation_error':
            return __('Validation errors occurred. Please confirm the fields and submit it again.', 'wpcf7');
        case 'accept_terms':
            return __('Please accept the terms to proceed.', 'wpcf7');
        case 'invalid_email':
            return __('Email address seems invalid.', 'wpcf7');
        case 'invalid_required':
            return __('Please fill the required field.', 'wpcf7');
        case 'captcha_not_match':
            return __('Your entered code is incorrect.', 'wpcf7');
    }
}

If this is not enough info then you can download the file from here and look at the whole source code.

Related posts

Leave a Reply

1 comment

  1. If you make sure you’ve upgraded to the latest version of this plugin, you can create multiple forms, each with their own response messages.

    To create a new form, go to Tools -> Contact Form 7 and click “Add new” (up the top in red).

    Fill out your new form details, then go to ‘Messages’ and click ‘show’. Here you can fill out the responses specific to this form. Once you’re done, scroll up again and click the ‘Save’ button on the right.

    You can then include a link to this other form in your posts by using something like:

    [contact-form 2 “My second form”]

    (The actual code to use will be shown on the page used to edit the form.)