Warning: Trying to access array offset on value of type bool in /home/hnakata/digitalestate.biz/public_html/wp-content/themes/luxeritas/inc/json-ld.php on line 120

About a conflict of WPML and Contact Form 7

2018年3月1日WordPress

This post is also available in: 日本語 (Japanese) Français (French)

WPML
Like other pages, I made the page called “Information & contact". As usual I also made French and English pages concerning this page.

The way of making is as follows. Let’s take an exemple of this page “About a conflict of WPML and Contact Form 7".

First, I create a New page or a New post. Then, WPML prepares related files of other languages predetermined in advance (in our site, English and French).


 

Parentage of page files

This becomes a parent page, a parent post. To create child pages or child posts, click+ mark of English or  French in the above figure.

is a mark waiting for update.

When the page is formed, it actually looks like the following.

The marks in the above figure are marked with related files in English and French, the original Japanese file has been modified, and the remaining two files are marks waiting for updates.

When parent-child pages are created, links to pages of other languages actually appear in Japanese pages as follows.


Contact form by Contact Form 7

Well, I want to attach a contact form to the page.

I decided to put a contact form by using the plug-in Contact Form 7, not forms in Jetpack to send a confirmation email to the customer. Based on the Japanese form on Contact Form 7, I  copied it and made also English and French forms by translating only the text part just as making multilingual pages by WPML.

Japanese form attached to Japanese page works without problems, but neither forms of English or French pages works. Even if I trial and error on Contact Form 7 it does not work at all. I got stuck.

Solving by creating independent page

I thought that it might be a trouble because the Japanese form of the parent page and the English / French form of the child page compete with each other. Then I make different pages as solutions. In other words, each of the three pages will be an independent parent page.  Sure enough, the problem was solved. Each page works on each form. In this way, the page of “Information & contact"  became three independent pages without parent-child relationship. In other words, each forme works on each page independently.

I checked it today again in another page.


Après cela, j’ai trouvé la solution suivante sur le site de rapport d’erreur WPML.org.

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:

1
add_filter( 'wpcf7_load_js''__return_false');

Merci beaucoup. Il a été sauvé.