Resolved

Resolved in: 4.0.0

Symptoms

Submitting the form in the secondary language fails. This producess the below console error:
xxxxx/wp-json?lang=es/contact-form-7/v1/contact-forms/XXX/feedback 404 (Not Found)

This issue occurs only when setting the language URL format to “Language name added as a parameter“.

Workaround

Add this code to the theme’s functions.php file, found in the ../wp-content/themes/theme-name/ folder:

add_filter( 'wpcf7_load_js', '__return_false' );

49 Responses to “Contact Form 7 – Secondary language form submission fails”

  1. J’ai essayer d’ajouter “add_filter( ‘wpcf7_load_js’, ‘__return_false’ );” dans le fichier “functions.php” j’ai un bug ‘affichage du site complet.
    Merci pour votre retour.
    Matthieu

  2. Hi!

    I’ve added the line of code to my functions.php file but I still get the post error when I try to submit the form in my secondary language. Please help!

    Kind regards,
    Pieter

  3. Hi

    I have several issues on site I’m developing. I can not find any place to create a topic for support?! One of my issues is that contact form 7 is sending on the site but not received.

    Thank you
    Erik

  4. Great!,

    This is worked for like a charm, this was my exactly issue and using the filter as recommended above just fixed my issue =)

  5. Hi,

    i have the same problem with the other language, but when i try adding this line
    add_filter( ‘wpcf7_load_js’, ‘__return_false’ ); to the function.php of the child theme
    the datepicker in the contact form isn’t working anymore.

  6. Thank you. This workaround solved my problem too.

    WordPress Version 4.8.2
    Contact Form 7 Version 4.9
    WPML Multilingual CMS Version 3.7.1

  7. It helped to submit the message but I’m now getting this errors on the page:

    Notice: WPCF7_ShortcodeManager::get_instance is deprecated since Contact Form 7 version 4.6! Use WPCF7_FormTagsManager::get_instance instead. in /var/www/staging.polishschool.org.au/public_html/wp-content/plugins/contact-form-7/includes/functions.php on line 355

    Notice: WPCF7_ShortcodeManager::scan_shortcode is deprecated since Contact Form 7 version 4.6! Use WPCF7_FormTagsManager::scan instead. in /var/www/staging.polishschool.org.au/public_html/wp-content/plugins/contact-form-7/includes/functions.php on line 355

  8. hi, added the code as listed, i still have the same problem.
    problem: the form is not sent

    i added the line of code to the last line. does it make a difference? i am not a coder.

    i am using contact form 7 Version: 4.9

    thanks

  9. Hi,

    The functions.php filter worked for us. But now we cannot see the icon loader we had when we submit a form. This is important because it lets the user see that the form is been submitted.

    Please your help,

    Thanks.

    • Hi we have other issue as well:

      We have a small contact form on our home page at the near bottom (https://actuaria.com.ec) and we try to submit the form, the page redirects to the blog page for some reason we don’t understand (on both languages).

      We have disable the code — add_filter( ‘wpcf7_load_js’, ‘__return_false’ ); — until we solve this issue.

      Please your help.

      Best,

      Sergio

    • Hello Stephan,

      We are about to release an update of WPML, but I’m afraid it won’t contain the fix.

      We need to resolve a conflict between CF7 and WPML when dealing with AJAX calls and languages in the URL.

      The proposed workaround might be still the final solution, but we need to investigate if a more elegant fix is possible.

      I’ll make sure to have this issue handled in the following release of WPML.

  10. Hi,

    I had the same problem. Tried the filter but obviously is something you don’t want because as many have pointed out, it doesn’t let the user know the form has been submitted.

    So here’s the solution that worked for me… I found it in another blog:


    add_filter('rest_url', function($url) {
    $result = preg_match('/(\?.+)\//U', $url, $matches);
    if (!$result || !isset($matches[0]) || !isset($matches[1])) {
    return $url;
    }
    $url = str_replace($matches[0], '', $url);

    return $url . $matches[1];
    });

    Add that instead of the filter to your functions.php in your theme. Make sure it’s the functions.php that is being read by your theme (if it’s a child theme or if its’ the actual theme) and it should work.

  11. hi,

    the workaround suggested here will not be helpful if you want to use JS on the contact form.
    for example i am using google recaptcha that displays ‘i am not a robot’ in the second language. but if i use that filter then JS is disabled and ‘i am not a robot’ goes back to english.

    other solution to change parmalink setting to ‘default’ will wreate havoc on my site as all the links are translated to the second language (including contact form) and leaves the whole site in a mess.

    i believe this needs to be fixed on WPML part. the original conact form in english is working fine. only the form in second language does not work (arrow keeps spinning) after you press ‘Send’.

    there’s some issues with WPML with handling ajax calls. i have another ticket opened for UserPro and that also is about a problem caused by ajax call and WPML not handling that call properly.

    thanks in advance for your help WPML.

    • Hi Dave,

      We have fixed that issue already so you can expect this fix in the next release. It was happening because CF 7 was submitting the form to a REST URL and WPML was messing the URL adding the language parameter in the wrong place.

      For the workaround, I don’t recommend it, not loading the JS assets may cause troubles like the one you experienced already.

      Hopefully that this fix will also solve other problems you are having with Ajax calls.