Roots/Sage 和 WPML:无法通过 wp-admin 访问 mu-plugins 文件。

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

Roots/Sage and WPML : Cannot access to mu-plugins files through wp-admin

问题

Using the Roots/Sage template, 我无法访问WPML的某些菜单项,比如"String Translation"。
与正常工作的菜单项不同,重定向的URL不同:

正常工作:https://myadress.test/wp/wp-admin/admin.php?page=tm/menu/translations-queue.php

不正常工作:https://myadress.test/wp/wp-admin/wpml-string-translation/menu/string-translation.php

它只返回404未找到,尽管文件存在于项目中(例如在web\app\mu-plugins\wpml-string-translation\menu\string-translation.php下)。

为什么不正常工作的URL结构与正常工作的不同?

我如何访问这些文件并消除404响应?

我尝试使用相对路径访问我的文件:
https://myadress.test/app/mu-plugins/wpml-string-translation/menu/string-translation.php

我得到了HTTP错误500:

PHP Fatal error: Uncaught Error: Call to a member function get_strings_settings() on null in /var/www/html/web/app/mu-plugins/wpml-string-translation/menu/string-translation.php:8
Stack trace:
#0 {main}
thrown in /var/www/html/web/app/mu-plugins/wpml-string-translation/menu/string-translation.php on line 8

这是string-translation.php文件的前8行:

<?php

use WPML\ST\Gettext\AutoRegisterSettings;

/** @var WPML_String_Translation $WPML_String_Translation */
global $sitepress, $WPML_String_Translation, $wpdb, $wp_query;

$string_settings = $WPML_String_Translation->get_strings_settings();

我的IDE自动在web\app\mu-plugins\wpml-string-translation\inc\wpml-string-translation.class.php下找到了WPML_String_Translation类,但我仍然收到上面的HTTP错误500。

英文:

Using the Roots/Sage template, I cannot access to some menu entries of WPML through wp-admin, like "String Translation".
Unlike the working entries, the redirect URL is different :

Working : https://myadress.test/wp/wp-admin/admin.php?page=tm/menu/translations-queue.php

Not working : https://myadress.test/wp/wp-admin/wpml-string-translation/menu/string-translation.php

It just return a 404 not found, while the file exists in the project (under web\app\mu-plugins\wpml-string-translation\menu\string-translation.php for example).

Why is the non-working URL structure differents from the working ones ?

How can I access to this files and get rid of the 404 response ?

I tried to access to my file with the relative path :
https://myadress.test/app/mu-plugins/wpml-string-translation/menu/string-translation.php

And I get an HTTP error 500 :

PHP Fatal error:  Uncaught Error: Call to a member function get_strings_settings() on null in /var/www/html/web/app/mu-plugins/wpml-string-translation/menu/string-translation.php:8
Stack trace:
\#0 {main}
thrown in /var/www/html/web/app/mu-plugins/wpml-string-translation/menu/string-translation.php on line 8

Here is the first 8 lines of the string-translation.php file :

&lt;?php

use WPML\ST\Gettext\AutoRegisterSettings;

/** @var WPML_String_Translation $WPML_String_Translation */
global $sitepress, $WPML_String_Translation, $wpdb, $wp_query;

$string_settings = $WPML_String_Translation-&gt;get_strings_settings();

My IDE automatically finds the WPML_String_Translation class under
web\app\mu-plugins\wpml-string-translation\inc\wpml-string-translation.class.php while I still get the HTTP error 500 above.

答案1

得分: 0

将插件从 mu-plugins/ 移动到 plugins/ 似乎修复了这个(奇怪的)问题。

英文:

It seems that moving the plugin from mu-plugins/ to plugins/ fixed this (weird) issue.

huangapple
  • 本文由 发表于 2023年5月10日 16:52:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/76216547.html
匿名

发表评论

匿名网友

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

确定