简体   繁体   English

插件文件被覆盖?

[英]Plugin File From Being Overwritten?

How can I keep a plugin from overwriting a file that has been customized?如何防止插件覆盖已自定义的文件? Can something be added to the functions.php file?可以在 functions.php 文件中添加一些东西吗?

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.如果您可以让我们更好地了解潜在需求是什么,那么很有可能有人可以为您提供非破坏性解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM