How to make sure changes to a Wordpress plugin won't be lost on plugin update?

假装没事ソ 提交于 2019-12-03 08:38:35

With themes, Wordpress has a concept of "child themes" which allows exactly that: to keep changes separate from main theme, in case it changes.

I haven't yet found a way to do this with plugins.

I'm using a few tactics myself:

  • I bump plugin version to a very high number like 99.9. This way Wordpress won't ever update the plugin.
  • Store my plugins in version control (i use git, but it doesnt matter), this allows you to update the plugin, run the 'diff' tool and see what changes happend. If you don't like you just revert like it would be a bad code you've written. But this approach requires a bit of skill.

Are you talking about running parts of a modified 3rd party plugin, and an updated version, at the same time?

That's not going to be possible. There is no magical method of "preserve my changes and transfer them into the new version automatically". The way to go here is doing a diff between the edited version and the update, and integrating the changes in the actual source files.

The bottom line is, if you manually edit a third party plugin, you're in for manual review (and possibly rework) once an update takes place. That's why it's usually not a good idea to extensively modify third party plugins.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!