4

I have several WordPress running plugins on my site and as per suggestions of wordpress performance optimizations I am planning to do the optimizations on plugins myself.

However, that will mean that I will have to modify existing plugins codes. Now, as WordPress plugins release frequent updates, the updates will wipe out my manual changes. How can I keep sync between these? That means, how can I get updated plugin and keep my manual changes as well?

3 Answers 3

3

Create a local repository in Git (or SVN) for the plugin, and each time an update happens:

  • merge the changes into your adjusted version,
  • test it in your local copy of the production site,
  • then push your updated code to your site.

But much better would it be to send your improvements to the plugin author, so she can use that in the main code. Keeping improvements secret is not the spirit of Open Source.

1
  • Thanks, I much appreciated the idea of using repository, I think am gonna use that. However, sure I will send update to the author also, but that may not come in action very soon.
    – Rana
    Commented Jan 28, 2013 at 6:58
1

It depends on what kind of mods you are going to perform. If plugin uses filters and actions, you can hook them, or deregister them and register your own modified functions instead of them, from your custom plugin or theme's functions.php.

You can read more about hooks and filters in codex.

1

There isn't really a practical way to go about this that will ensure you can update plugins that you have modified and still guarantee your changes will work, unless you inspect the newly released code prior to merging your changes.

So that means every time a plugin update is available, you would need to check that the modifications you have made are still applicable to the newly updated code base because in some instances a plugin author may change their Class/Method/Function structure so as it represents nothing like the changes you have made.

In cases where your modifications do not work in the context of the newly released version of said plugin then you will need to re-adjust accordingly.

You need to keep a local repository/copy/version of your changes and check those against future updates.

This all requires some effort on your part, attention to detail, that would otherwise be better focused toward trying to convince the plugin authors in question to make the same changes that you have made for improved performance.

Your Answer

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

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