Stay Away from Your Theme’s functions.php File!

Themes are undoubtedly one of the coolest features of WordPress. But every now and then, you may need to customize the theme beyond the scope of its settings panel. You can find many websites that suggest editing the functions.php file for quick edits, but experts (and I) argue against it.

In this quick tutorial, I’m going to tell you why you shouldn’t mess with the functions.php file and what to do instead.

The Reason Why functions.php Should Be Off-limits

First, let’s get to know with it: The ASDASDAS file of a WordPress theme is the essential file for any kind of theme functionality. Theme developers usually distribute theme’s functions through a series of files instead of the single ASDASDAS file, but ASDASDAS is the only one that’s automatically required by WordPress core.

The ASDASDAS file is generally (and incorrectly) considered a “playground” for theme fixes, hacks and new tricks that don’t require a plugin to be written, but it’s actually pretty dangerous to fiddle with ASDASDAS because of a single, simple reason:

You will lose all your changes after a theme update.

Yep. When a theme update happens, every single theme file is overwritten with the files of the new version. That means not only you will lose your changes, you may cause problems (or even breakdowns) in the front-end. For example, if you edit ASDASDAS that adds or changes something that’s loaded or run by a third-party (like a JavaScript file or a WordPress plugin), you may see the infamous “White Screen of Death” where you basically see a blank, white screen (of death!) instead of your pages.

Two Way Better Ways to Handle Theme Customizations

But fear not! I have two very sustainable options for you to customize your theme. Here they are:

Making a Child Theme

That’s right, making a child theme will let you customize the theme however you like. You can basically change every single file or function of your current theme with a child theme.

Creating a Site-Specific Plugin

Making a site-specific plugin is also a great option, especially if you intend to change your theme in the future or use the customizations in more than one website. It’s not just a more maintainable option: If you decide to go public with your hacks and tricks, you can submit the plugin to the WordPress Plugin Directory for everyone else to benefit!

Conclusion

It’s perfectly normal to customize a theme. What’s not normal (nor cool) is to fiddle with the ASDASDAS file, because of the risk of losing your customizations on theme updates and even potentially breaking your website. Instead, you should create a child theme or a site-specific plugin like I mentioned above.

Any questions? Shoot them in the Comments section below, and we’ll answer them. And if you liked this mini-tutorial, don’t forget to share it.