Protect your WordPress theme from update changes

When it comes to WordPress websites, one of the biggest issue for site owners/developers is making updates to the theme. Updating the theme can be a simple process, but it often leads to unexpected changes that can change the look and feel of the site in an unwanted way. In this article, we’ll explore how to protect your WordPress theme against these update changes.

Your mileage may vary in terms of usage and methods. But let’s say you installed a theme and then you made some changes to it to make it compatible for your site look and feel or functionality. In this case an update will just overwrite your changes. Please keep in mind that updates are very important, don’t miss on it.

Another scenario is to extend your own theme instead of just editing it every time.

We’ll explore two ways to avoid these issues.

1- Child theme

This is a common and simple way to extend your theme. It does not affect the parent theme and you can safely update it anytime you want. Child themes are useful in many ways like for example, adding a simple function to add some functionality or adding analytics js to head or footer etc. You can also change the look and feel of your theme (website) through CSS changes in the child theme which will extend the parent one and override it where necessary.

WordPress and everyone you come across will suggest using a child theme, which is the best approach for changes you would like to keep and not in a hurry to change the theme anytime soon.

I have wrote an article on this, which can help you get started with a child theme.

2- WordPress plugin

This is my preferred way of adding things to my website using WordPress. This works better, because if you even change your theme after sometime, this does not need any change. Which means, write once and use it every time without any change.

If you are adding a simple analytics to your website:

  • Create a simple one page plugin
  • Upload it your WordPress plugins
  • Enable it and job done

There is an article here how to create a plugin. Now it would be up to you to make it a simple one or a complicated one. That is dependent on your requirements.