被覆盖的插件文件?

发布于 2025-01-21 23:39:10 字数 50 浏览 3 评论 0原文

如何防止插件覆盖已定制的文件?可以将某些内容添加到functions.php文件中吗?

How can I keep a plugin from overwriting a file that has been customized? Can something be added to the functions.php file?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陪你搞怪i 2025-01-28 23:39:10

简单的答案是您不。修改插件或主题可防止您将来更新插件/主题 - 通过设计,您的更改将丢失。您可以从理论上更改插件目录的文件系统权限(不仅是您修改的文件 - 您必须在此时冻结整个插件/主题或风险致命错误),但这是不好的练习 - 更新是有原因的!更好的问题是,为什么您需要修改插件?通常,插件使您有机会修改其行为或以其他方式扩展它们(即使它们没有得到很好的记录)。如果您可以更好地了解基本需求是什么,那么有人很有可能会给您一个无损的解决方案。

The simple answer is you don't. Modifying plugins or themes prevents you from updating the plugin/theme in the future - by design, your changes would be lost. You can theoretically change the filesystem permissions for the plugin directory (not just the file you modified - you have to freeze the whole plugin/theme at that point or risk fatal errors), but that's bad practice - updates happen for a reason! The better question is why did you need to modify the plugin? More often than not, plugins give you the opportunity to modify their behavior or otherwise extend them (even if they aren't well documented as such). If you can give us a better idea of what the underlying need is, there's a fairly high chance someone can give you a non-destructive solution.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文