Is it a good idea to edit an already existing plugin to add more functionality?

I need to add a relatively small bit of functionality to a WordPress plugin and I have the option to either edit the plugin directly, or scrap the plugin completely and repurpose PHP code from another site to do the same thing. Repurposing non-Wordpress PHP code for such a small change seems silly and I have the few lines of PHP I would use when editing the plugin. My question is, is it a good idea to edit a plugin?

I know that when editing a theme, if the edits are done directly to the old code, when the theme is updated the changes will be lost. Does this happen with plugins too? Is there a way around this?

For those wondering how complicated the changes are, I’ll explain briefly. The client I have wants a form submission to go to a dealer and the user. But on certain circumstances depending on the user’s email address (if it ends in “.gov” or a few other endings… yes I know this isn’t the best idea and I tried to convince the client but they were adamant) the client wants the email to go to someone else. Naturally this could be cured with a few small PHP lines in the plugin but the plugin doesn’t have the functionality for “conditional recipients” based on content sent by the user. So I’d like to either add that functionality just for this site (if it can be done quickly) or I’d like to replace the plugin with straight php which seems like it would cause more problems than it would fix initially. Time is of the essence. Thank you so much for your help!

3 s
3

The most important question which you must ask yourself is Am I the author of the theme or plugin?. If your answer is yes, and you are responsible for the up keep of the plugin or theme, go ahead and change it and modify as you like.

If your answer is no, then you should not make any changes to it, not even a small thing as a simple dot .. The same goes for WordPress core files. The simple reason being, as you’ve stated, if the theme/plugin/core is updated, you will lose whatever you have done to the theme/plugin/core.

I would recommend that you create your own small functionality plugin with this extra functionality. It is quick and easy, and will save you many tears later as it will not be overwritten unless you do it yourself.

Leave a Comment