skip to Main Content

Tried to add Twig to my WordPress-plugin I’m working on, but it seems like it clashes with my sites WPML installation. I get the following PHP Error:

PHP Fatal error: Cannot redeclare twig_cycle() (previously declared in ***/wp-content/plugins/sitepress-multilingual-cms/vendor/twig/twig/lib/Twig/Extension/Core.php:288

Can’t find any useful information about how to handle this googling/stackoverflowing. Any ideas?

2

Answers


  1. Chosen as BEST ANSWER

    One way to solve this,that I really dislike, is to downgrade to Twig 1.32.0 which seems to be the version WPML is using.


  2. I had the same issue and managed to make them live together. If i remember correctly when that error appeared i just had to disable both WPML and my plugin which was using twig internally and then try to activate one or the other until i found the correct order of activation. This somehow solved it for me.

    If this is not working, maybe you need a newer version of WPML or review your Twig init function

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search