WordPress is infinitely customizable. All the code is open sourced, and you can just open up an FTP program and change anything you like – from themes, plugins, to even the core files. That doesn’t mean you should, however! Particularly, the core files are something that you should absolutely leave alone. If you want to change your theme, then you should take precautions and create a child theme, so that you don’t lose your changes when the theme is updated. However, modifying plugins is a bit of a grey area. It’s not as bad as changing core WordPress files, but it’s still easy to mess things up badly.
In rare situations, I sometimes find it necessary to modify plugins. Here’s why I need to do it, and how I go about it safely.
When Should You Modify Plugin Files?
Typically, this happens when you need to add or remove some functionality to a plugin. For example, I wrote earlier about how I managed to defer inline JavaScript by changing type=”text/javascript” to type=”module”. This provided me with such a boost of speed on some of my plugins, that I simply couldn’t afford to not implement them. Naturally, I messaged the plugin author and asked them if it would be possible to make the change formally, so that I needn’t worry about potentially messing things up, but I wasn’t successful.
As a result, I had no choice but to make the change to the plugin files myself. This brings with it the following dangers:
- Without a deep knowledge of the plugin’s inner workings, you don’t know if you’re accidentally messing things up.
- You might be unaware of some security practices that dictate why the plugin is written in a particular way.
- Your changes will be lost when the plugin author makes an update.
It’s the 3rd point that’s the most hazardous. There’s not much you can do about the first two, other than relying on your knowledge of PHP, and making sure there are no risks. Sometimes the change is so minor, that it’s unlikely to have any negative, unforeseen consequences to plugin functionality. So all we’re now left is to deal with the third problem.
How I Keep Track of My Changes
You may think you’ll remember what changes you made to which file, but human memory is a tricky thing. Some plugins have complicated folder structures, and it’s not at all obvious which file does what. So when you’ve identified the change to the particular file in question, you need to write it down in a dedicated space. Make sure that you’re as unambiguous as possible, so that you know not only what file is modified, but also what the exact changes are.
I have two plugins to which I’ve made modifications. And as I’ve written earlier, I always wait for at least 4 days before updating a plugin. This way, I don’t have to keep updating the same plugin again and again as they work out their bugfixes. So once I’m sure that a particular update is stable, I do the following:
- Take a backup of my current installation (everything – files, databases, cPanel)
- Open my notes to refresh my memory about what changes I made where
- Update the plugins
- Use FTP to re-do the changes
- Test and see if all is well
- If something goes wrong, restore the backups and figure out what happened.
Safety is the First Priority
In all things, the most important thing is to make sure that you don’t harm your site. Take plenty of backups as an abundance of precaution, and always keep track of your changes so you can revert back easily if necessary.
I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!
Leave a Reply