What is your actual question? How to prevent a plugin that you have modified from being overwritten when an updated version is released?
Thread Starter
lch503
(@lch503)
No, I understand all the files are overwritten in the update process, but obviously then what I have changed is also overwritten.
I was wondering if there is a filter / hook procedure for adding whole functions to a file, rather than just adding a few lines of code here and there in functions that already exist (like I do in the filter / hook process).
Can this be done by maybe making my own plugin instead? Like having an add-in to the plugin?
No, I understand all the files are overwritten in the update process, but obviously then what I have changed is also overwritten.
You can have the cake, or you can eat it, but both is a little more complicated.
The original plugin author obviously isn’t going to stop releasing updates, so two options that come to mind right away are:
A) Properly rename the plugin. That prevents your changes from being overwritten, however also it prevents automatic updates to features you didn’t change.
B) Add a filter to the plugin functions file to prevent update checks for that specific plugin only. Possible Example:
add_filter('site_transient_update_plugins', 'remove_update_nag');
function remove_update_nag($value) {
unset($value->response['plugin_name/plugin_file_name.php']);
return $value;
}
Same ends, different means… but again, the downside is that you receive no updates to the plugin features that you have not modified.
The only other solution I can think of at the moment, is to take all of your own modifications and place them in a text file and store them locally for future reference. Then each time after the plugin updates, a “copy & paste” of your own functions to the updated file seems like a minimal effort solution.
Something else to consider might be whether or not the functionality you need/added would work from the functions.php file in your active theme, rather than in the plugin. I guess that might be a possibility as well, depending on the plugin.