I need to modify some *.php
file of some plugin, but I don't want to modify it inside the plugin dir for the obvious reasons(updates etc). Is there any acceptable and known way to do this? Like placing this file in the theme folder or something close to this?
1 Answer
It is not possible to override a file (not technically 100% true, but you don't want to go the way that will make it possible), and in any case, if it was possible the long term effect would be similar to the one you are trying to avoid - when upgrding the plugin, the upgrade might not have any impact, since your file will override it.
Good plugins will provide API or filters and actions which will enable you to change their behavior without risking that an upgrade will nullify them. If not possible, and you just have to have the change, just use a tool like git to track your changes, and at least when a new upgrade will arrive you will have easier life when merging your changes into it.
-
Thank you. Just to clear here something: if I change the file inside of plugin, it will be replaced or merged after the update(if this file needed to be updated)?– dufaCommented Apr 7, 2016 at 12:57
-
replaced, that is why you will need to handle merges off the site, and just not do automatic updates for that plugin Commented Apr 7, 2016 at 13:16