Wordpress网站使用siteground security optimizer 及 translatepress多语言插件的翻译问题

问题:

发现有的页面翻译出错,如下图:

经排查,原因是 SiteGround 主机安全插件中的"锁定并保护系统文件夹"功能 ,阻止了 TranslatePress 插件的 trp-ajax.php 文件正常执行。

解决方法:

trp-ajax.php 加入白名单

这个方法既能保留 SiteGround 的安全防护,又能让 TranslatePress 正常工作。

操作步骤:

  1. 关闭 SiteGround Security Optimizer 插件中的 "锁定并保护系统文件夹" 功能

  2. 将以下代码添加到主题的 functions.php 文件中:

  3. 重新开启"锁定并保护系统文件夹"功能。

    add_filter( 'sgs_whitelist_wp_content', 'whitelist_trp_ajax' );
    function whitelist_trp_ajax( whitelist ) { whitelist[] = 'trp-ajax.php';
    return $whitelist;
    }

关键提示 :一定要先关闭该功能、添加代码、再重新开启。这样系统会重新生成 .htaccess 规则,把 trp-ajax.php 排除在保护之外。只需要写文件名,不需要写完整路径。

相关推荐
曲幽3 天前
你的Agent API还在裸奔?从认证到沙箱,我用FastAPI搭了几道防线
python·fastapi·web·security·jwt·oauth2·limit·sandbox·ai agent
汤愈韬7 天前
防火墙主备备份的非VRRP的三种模式
网络·网络安全·security
汤愈韬17 天前
Full Cone NAT、行为模式
网络·网络协议·网络安全·security
汤愈韬18 天前
三种常用 NAT 的经典案例
网络协议·网络安全·security
汤愈韬18 天前
NAT Server 与目的Nat
网络·网络协议·网络安全·security
汤愈韬24 天前
防火墙双机热备
网络协议·网络安全·security
汤愈韬25 天前
防火墙双机热备之VRRP
网络·网络协议·security
mounter6251 个月前
深度解析:Linux 内核为何要移除“直接映射” (Direct Map)?
linux·运维·服务器·security·linux kernel·direct mem map