1

I have to make some changes to some functions in a plugin that don't have hooks and aren't pluggable.

My idea was to wrap the functions I modify in a if ( ! function_exists()) and move my modifications into a separate plugin. Then whenever I need to update the plugin, I just re-add the if ( ! function_exists()) wrapper.

Please tell me why this is a bad idea and what I should be doing instead.

2
  • Well, if possible, maybe you could find a new plugin that's is easier to work with. I mean every time the plugin updates you'll have to watch for any changes with the functions which you may need to be very vigilant of as it could fatal error your site depending on how drastic the plugin author modifies his functions compared to yours.
    – Howdy_McGee
    Sep 15, 2014 at 20:29
  • Unfortunately this client relies on this plugin for a large portion of his business. If anyone knows of a good event plugin that handles registrations, payments, etc. that ISN'T Event Espresso, I'm all ears.
    – dallen
    Sep 15, 2014 at 21:03

3 Answers 3

2

It seems like the plugin you are using are quite important to you and/or your client, and the plugin itself is most probably regulary updated with proper support.

I would definitely contact the author and discuss possible changes to the plugin. If a change is a constructive change and would bring some degree of usefulness to the plugin, I see no reason why the author would not implement your changes in the near future releases/updates.

Primarily, if your change is to out of scope of the current plugin, you can suggest and ask the author to just add a proper filter where needed in future releases/updates.

But yes, I would start at the plugin author for such kind of support before looking into other solutions

0

I can think of not even one example to a plugin that do not use filters. Almost all plugins use options to store data and therefor use the option related hooks.

your plugin probably uses many actions and filters, they are not on its high level code, but it does not prevent you from using them to change the plugin's behavior.

Another possibility is to use output buffering to manipulate the output if there is no other way to influence its generation.

0

if the plugin you are wanting to manipulate exists as a class, you might be able to overwrite it with __call function in your class (extends the original). that keeps you from editing files; you might have to rewrite your plugin to keep up with the other plugin, but I think extending the plugin's class is your best option, given the author's neglect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.