If you’re using Page Builder Sandwich along with Wordfence Security, there’s a chance you might have encountered something called a 403 error.
Now, according to WordPress resource site WPBeginner, 403 errors occur when server permissions don’t allow access to a specific page.
但是 403 错误究竟意味着什么,为什么它一开始会在 Page Builder Sandwich 中出现?
The 403 Error Explained
403 错误最常见的原因是安全插件未按照特定方式或标准进行配置。
Like WordFence, most security plugins from WordPress restrict some actions if they’re suspected or proven to be malicious. These scenarios usually occur on your WP Admin or WP Login page, or show up as pop-ups alerting you that you don’t have authorization to view your page.
如果您在 Sandwich 上遇到此弹窗,它将显示为以下样式:
So what does this mean? Is Sandwich safe to use? Is WordFence bad? And does the 403 error warrant bad points for both Wordfence and Page Builder Sandwich?
其实不然。
All of this just means that Wordfence is extra careful when scanning your external plugins.
And that’s actually a really good thing, especially since they’re a security plugin.
WordFence is Legit…
WordFence 是 WordPress 最受欢迎的安全插件之一。它拥有超过一百万的活跃安装量,因此很有可能您的 WP 网站上也安装了它。它们的存在是为了一个崇高的目标:不仅要确保您的网站安全,还要降低安全风险,并全面提升您网站的安全性。
tl;dr(长话短说):WordFence 是靠谱正规的。
…And So is Sandwich. But Why Does It Need Whitelisting?
WordFence 拦截的并不仅仅是 Sandwich。
其他插件和 URL 也需要在 WordFence 上加入白名单(黑名单的反向操作)。一些更热门的插件可能已被 Wordfence 默认允许。
那么后台到底发生了什么,403 错误又是从何而来的呢?
Ajax Functions and Page Builder Sandwich
Page Builder Sandwich 在您的整个编辑体验中都会执行 ajax 功能。某些插件也会这样做。
W3Schools 对 ajax 进行了进一步阐述:
AJAX is a technique for creating fast and dynamic web pages. It allows web pages to be updated asynchronously by exchanging small amounts of data with the server behind the scenes. This means that it is possible to update parts of a web page, without reloading the whole page.

在 Page Builder Sandwich 中,ajax 调用涵盖从获取简码映射、渲染简码到保存更改的各种操作。 这可能会导致您遇到一些问题,例如 403 错误、保存输出时出错或简码未渲染。这时您可能需要将特定于 Page Builder Sandwich 的 ajax 调用加入白名单。
Whitelisting Page Builder Sandwich on WordFence
要在 Wordfence 的防火墙中将 PBS 加入白名单,请在 Whitelisted URLs(白名单 URL)区域中添加一条包含以下参数的条目:
URL: /wp-admin/admin-ajax.php
Param Name: main-content
Param: POST Body
对于多站点 WordPress 安装,建议在上述 URL 中包含您站点的文件夹名称。例如:/my-multisite/wp-admin/admin-ajax.php
添加这些值后,403 错误应该就能得到妥善解决,并且您应该能够重新保存输出并生成已渲染的简码。
在您的 WordFence 防火墙设置下,它应该显示如下:

Conclusion
是的,Page Builder Sandwich 是可以安全使用的。
不仅如此,它仅在编辑模式下执行 ajax 操作,并且与外部插件和主题兼容(只要它们符合 WordPress 的编码标准)。
WordFence Security 也是如此。
但它们出色的一点在于,它们为 WordPress 用户提供了确保网站安全无虞的机会,并提供了额外选项,让您可以自主决定哪些插件是安全的,哪些不是。