首页 > 解决方案 > 无法清除 gettext 缓存

问题描述

我正在玩gettextWordPress 中的钩子并做了这样的事情:

add_filter("gettext", "test", 20, 3 );
function test($translation, $text, $domain) {
    return "hello world";
}

正如预期的那样,WordPress 仪表板中的许多菜单项都更改为“hello world”。现在我不能把它们改回来。这是我尝试过的:

  1. 删除上面的代码块functions.php
  2. 重启php-fpm
  3. 重启nginx
  4. 重新启动服务器
  5. 清除 WordPress 缓存(WP Super Cache)

我不确定还有什么可以尝试的。一些菜单项仍显示为“hello world”。奇怪的是,并非所有菜单项都卡住了,而且它似乎只发生在前端显示管理栏时(我在后端看不到任何“hello world”项目)。有任何想法吗?

标签: phpwordpresscachinggettext

解决方案


您是否尝试使用 删除过滤器remove_filter,这里是代码:

// remove the filter 
remove_filter( 'gettext', 'test', 20, 3 ); 

如果一切顺利,请告诉我。


推荐阅读