【发布时间】:2020-10-08 15:38:26
【问题描述】:
我在 WordPress 中使用 gettext 钩子并做了这样的事情:
add_filter("gettext", "test", 20, 3 );
function test($translation, $text, $domain) {
return "hello world";
}
正如预期的那样,WordPress 仪表板中的许多菜单项都更改为“hello world”。现在我不能把它们改回来。这是我尝试过的:
- 从
functions.php中删除上面的代码块 - 正在重启
php-fpm - 正在重启
nginx - 重启服务器
- 清除 WordPress 缓存(WP Super Cache)
我不太确定还能尝试什么。一些菜单项仍显示为“hello world”。奇怪的是,并非所有菜单项都卡住了,而且它似乎只发生在前端显示管理栏时(我在后端看不到任何“hello world”项目)。有什么想法吗?
【问题讨论】:
-
你能把问题截图吗?
-
根据文档
If there are functions hooked to this filter, they will always run. This could lead to a performance problem,您的代码中是否还有其他函数test?
标签: php wordpress caching gettext