If I make changes to a plugin's PHP file, e.g. located in wp-content/plugins/plugin-name/, how do I prevent my PHP edits from getting erased once an update for the plugin rolls out? Is there such a thing as creating a child folder for plugins?


3 Answers 3


You don't, for the same reason you don't modify WordPress Core, you extend it or use hooks and filters to modify its behaviour.

So when extending or changing plugins you have 2 options:


You've been creating forks of a plugin so far, but it's important to change the name when this happens so your new plugin isn't overwritten. You'll need to manually port over changes from the original code base

Hooks, Filters etc

Create a new plugin, and use hooks and filters to interact with the plugin. A good plugin will provide filters to modify values, and hooks to allow your own plugin to intercept and adjust things.

You can use this to register new css/js, or disable functionality by removing filters/hooks added by the plugin and replacing them with your own.

You'll need to read the code of the plugin and refer to its documentation for what's possible.

Remember, plugin code is just code. Each plugins code shares the same environment so the idea of a parent or child plugin makes no sense. Only the order plugins are loaded and wether they're activated or not has any bearing here

  • Thank you, this definitely gives me a better idea on the matter
    – Vibrains
    Commented May 13, 2015 at 23:48

There is no such child folder, but depending on the type of change, you can write a new plugin to override the code.

If it's Revolution Slider, be sure you're reading all the documentation to be sure you actually need to be doing the edits in the first place. Most things you would "need" to change might actually be settings.

  • No it's not revolution slider, that was just an example. The last edit I made to a plugin was actually The Events Calendar. What would be a good starting point for me to learn how to override the code? Is there something that I could read? Thanks.
    – Vibrains
    Commented May 13, 2015 at 18:28
  • It really depends on how the originating code is written. Some have templates that are designed to be overwritten, some don't. It's too vague to give specific directions, but generally speaking everywhere that a function hooks into WP you can hook in with a different priority. Another alternative is actually copying the plugin code to a different name, and altering the plugin, but keeping the update notices from triggering at all - if it's something you'll be updating yourself. How to make a plugin: codex.wordpress.org/Plugin_API Hooks: codex.wordpress.org/Plugin_API/Hooks
    – ambroseya
    Commented May 13, 2015 at 18:48

Various possibilities. If fixing a bug, I'll sometimes actually make a patch and send it to the Plugin author. More than once they've added the patch and said thanks.

Beyond that, if you really need to hack a plugin, you should also change the folder and header info so that the auto-update doesn't recognize it. Of course you'll not get new updates.

There are some plugins that get mirrored on GitHub or similar. If you get it from there you might be able to merge new updates while maintaining your own modifications. That's a fairly unusual situation though.

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.