This thread is resolved. Here is a description of the problem and solution.

Problem: I get this error in the backend: Twig_Error_Syntax Solution: The issue was being caused by a conflict with Twig Extension

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 6 replies, has 3 voices.

Last updated by Vincenzo 1 year ago.

Assigned support staff: Vincenzo.

Author Posts
May 3, 2019 at 8:09 pm #3737743


I am trying to: install and configure WPML

Link to a page where the issue can be seen: Happens only in the admin

I expected to see:

Instead, I got:

- - -

Both sites above have the same WP, Timber and WPML versions.

The one without the bug is a little bit older and worked well.

The buggy one was installed yesterday with the most recent plugins (WPML and Timber) but the issued with Twig just arose.

I then tried to downgrade to the same versions as the other sites but it didn't worked anymore...

Functioning Versions:
WP - 5.0.4
WPML - 4.2.1
Timber - 1.9.0

Problematic Version (the first time it happened):
WP - 5.1.1
WPML: - 4.2.6
Timber: 1.9.4

May 4, 2019 at 9:33 am #3739641


Languages: English (English ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

Hello, thank you for contacting WPML Support!

This seems to be a conflict between WPML and a theme or a plugin using Twig.

Try the following steps, preferably on a staging version of the site:
❌ Before proceeding please make a full website backup! ❌
- Disable all the plugins except WPML and its add-ons
- Set a default theme (eg. Twenty Nineteen).
- If the issue is solved, please re-enable the Plugins one after the other, and check the issue each time you enable a plugin.
It might also be due to the Theme.
Please do reactivate your Theme only after you are sure the issue isn't coming from a 3rd Party Plugin.

- Please report me when the issue comes back.

Thank you

May 4, 2019 at 12:08 pm #3740231


Hey Vincenzo, thanks for the response.

Yes I use this plugin/framework called "Timber" that also uses Twig and probably there is this incompatibility between them.

I cannot disable it because my whole theme (that is 100% custom made) will not work without it being enabled.

However, I've always used it with WPML and have not had any issues, this one is the first time.

And, for some reason, even if I install the same versions of the working environment (look at the screenshot) it still does not work.

What else could be done?

May 4, 2019 at 1:15 pm #3740351


Languages: English (English ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)


Our developers are planning to update the twig version in the 4.3.0 version of WPML.
This should fix the incompatibility.

In the meantime, you can try these possible solutions:

1. Try clearing the WPML templates cache.
You can do it by following these steps:
- Go to WPML -> Support
- Click on the troubleshooting link
- Press the "Clear the cache in WPML"

If the issue is not fixed, try pressing the "Disable cache for language switcher templates" button on the same page.

2. You can try using a plugin to change the load order of the plugins to try to temporarily fix this:

3. Try switching the PHP version used for the site.

Please let me know if you need further details.

Thank you

May 7, 2019 at 5:23 pm #3760997


Hey Vincenzo, thanks for the feedback.

The issue was being caused by a conflict with Twig Extension (hidden link) a package that was there from another project.

Strangely, the conflict were showing when we activated Gravity Forms, which is totally awkward since it does not even use Twig for templating.

After all, it was solved by removing this autoloader from functions.php and then everything went back to normal.

May 9, 2019 at 2:34 am #3772205

Minh Nguyen

@vincenzo: do we have the timeline of v4.3.0? We are using Timber in our theme and also have the compatibility issue with WPML on PHP 7.x.


May 9, 2019 at 8:08 am #3774001


Languages: English (English ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

I'm glad to know that the main issue was solved.

We don't know when new versions will be published.

You may follow our blog for news about new releases (beta and production).

Please let me know if you need any further assistance and I will be happy to help.

Kind regards,