I always do changes on the WordPress plugins for clients. But these changes are always in danger to be lost if the plugin is updated.
Is there is a way to make a plugin for another plugin in WordPress? Is there is a way to preserve the changes or re-apply it after each plugin update.
I think best way to do this is via actions and filters, like we extend WordPress core itself.
Other options is like @helgatheviking pointed, if plugin is class you can extend it.
Unfortunately not all plugin developers provide useful filters and actions with their code, most often plugin isn’t written in OOP manner. Only way to save your modifications on plugin update, is to create copy of original plugin, change plugin name. I usually prefix original name e.g.
Mamaduka Twitter Connect
, but with this solution you’ll need to manually update original plugin’s code.If you think that plugin needs more filters/action, you can contact the author and ask him to include those hooks into the core.
One simple way would be to define custom hooks within your plugin that you can hook onto. The in-built hooks system allows for you to create your own hooks and then bind onto them like normal WordPress hooks. The WordPress Codex has great examples and explanations of the do_action function and how you can use it to create custom hooks. A seriously overlooked feature in WordPress by plugin and theme developers.
I am a firm believer that the hooks system is all you need to develop plugins that can be extended by other plugins, but as I said seriously overlooked by 90% of all WordPress developers.
See below for an example (taken from the WordPress Codex link provided):
FWIW, you can increase the plugin version number so that it doesn’t auto update. while its not the best solution, it’ll solve the immediate problem. You could also change the naming and filenames so that they aren’t the “same” plugin anymore.