当我更新 Elementor 和 PhLox pro 插件时,我的网站出现故障。

huangapple go评论148阅读模式
英文:

When I update Elementor and PhLox pro plugin my website breaks

问题

我对WordPress开发相当新,因为我讨厌依赖插件兼容性和会破坏一切的更新。

我有一个客户的WordPress网站,完全过时(WordPress 5.x,PHP 7.2,所有插件比它们应该的版本旧了5个版本以上)。

到目前为止,我成功地将网站下载到本地并设置好,以确保更新不会出错,更新WordPress和大多数插件时并没有遇到太多麻烦,除了...你猜对了...Elementor和相关插件(PhLox)。显然,升级Elementor不是问题,但升级PhLox就是问题。

当我更新Elementor(和Elementor专业版)时,我的网站会显示为空白,当我检查PHP日志时,它会显示PHP Fatal error: Uncaught Error: Class 'Elementor\Scheme_Typography' not found in D:\wamp64\www\...,这是因为PhLox没有被更新。现在,显而易见的做法是更新PhLox,这也是我尝试做的,但这样做结果出现了另一个错误PHP Fatal error: Uncaught Error: Call to undefined function auxin_kses() in D:\wamp64\www\...

PhLox社区似乎对这个错误没有答案,所以我不确定该怎么办。有任何想法吗?

英文:

I'm quite new to WordPress development since I hate being attached to plugin compatibilities and updates that break everything.

I have a client with a wordpress site which is completely out of date (wordpress 5.x, php 7.2, all plugins more than 5 versions older than they should).

So far, I managed to download the site locally and set it up to check that updates don't break anything, and I did not have much trouble updating wordpress and most of the plugins except for...you guessed it...Elementor and related plugins (PhLox). Apparently upgrading Elementor is not the problem, but PhLox is.

When I update Elementor (and Elementor pro), my site shows up blank, and when I check PHP log, it says PHP Fatal error: Uncaught Error: Class 'Elementor\Scheme_Typography' not found in D:\wamp64\www\..., which is due to PhLox not being updated. Now, the obvious thing to do would be to update PhLox, and that's what I tried to do, but doing that I ended up having another error PHP Fatal error: Uncaught Error: Call to undefined function auxin_kses() in D:\wamp64\www\....

There seems to be no answer from PhLox community regarding this error, so I'm not sure what to do. Any idea?

答案1

得分: 0

经过几个小时的研究,我只找到了一个可能的解决方案(只是半个解决方案)。

我的网站在更新了每个插件后都无法正常工作,问题显然是来自于PhLox,而PhLox似乎几乎没有支持(真是可耻)。我决定尝试保留旧版的PhLox,并解决与新版Elementor的兼容性问题。事实证明,唯一损坏的是对旧的Elementor\Scheme_Typography的引用,现在应该改为Elementor\Core\Schemes\Typography。因此,解决方法如下:

  1. 要么替换所有对Elementor\Scheme_Typography的引用为Elementor\Core\Schemes\Typography
  2. 要么在wp-content下创建一个名为mu-plugins的文件夹,然后在其中放置一个名为(例如)phlox-fix.php的PHP脚本,其中包含以下代码:
<?php
/**
 * Plugin Name: Elementor Scheme_Color and Scheme_Typography Class Issue
 **/
namespace Elementor;
\add_action(
  'plugins_loaded',
  function() {
    if ( ! class_exists( 'Elementor\Scheme_Color' ) ) {
      class Scheme_Color extends Core\Schemes\Color {}
    }
  }
);
\add_action(
  'plugins_loaded',
  function() {
    if ( ! class_exists( 'Elementor\Scheme_Typography' ) ) {
      class Scheme_Typography extends Core\Schemes\Typography {}
    }
  }
);
?>

这对我有用,现在我有一个“不太过时”的网站,但由于PhLox没有更新,无法在高于7.x.x的PHP版本上运行 -.-'

希望对某人有帮助。

英文:

After several hours of research, I only found one possible solution (which is only half a solution).

My site was not working with every plugin updated and the problem was apparently comming from PhLox which has little to no support apparently (Shame on them). I decided to try to keep the old PhLox version and just solve compatibility issues with new Elementor version. It turns out, the only broken thing was a reference to old Elementor\Scheme_Typography which is now Elementor\Core\Schemes\Typography. So the solution is:

  1. Either replace all references to Elementor\Scheme_Typography to Elementor\Core\Schemes\Typography
  2. Or Create a folder under wp-content named mu-plugins and place inside a php script named (for instance) phlox-fix.php with the following code:
&lt;?php
/**
 * Plugin Name: Elementor Scheme_Color and Scheme_Typography Class Issue
 **/
namespace Elementor;
\add_action(
  &#39;plugins_loaded&#39;,
  function() {
    if ( ! class_exists( &#39;Elementor\Scheme_Color&#39; ) ) {
      class Scheme_Color extends Core\Schemes\Color {}
    }
  }
);
\add_action(
  &#39;plugins_loaded&#39;,
  function() {
    if ( ! class_exists( &#39;Elementor\Scheme_Typography&#39; ) ) {
      class Scheme_Typography extends Core\Schemes\Typography {}
    }
  }
);
?&gt;

That's what worked for me and now I have a "less-outdated" site which cannot run yet with versions of php higher than 7.x.x due to PhLox not being updated -.-'

Hope it helps someone

huangapple
  • 本文由 发表于 2023年6月19日 20:49:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/76506800.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定