Use the code LIFETIME at checkout and get 20% off our limited-time lifetime plans. Offer available until September 21.

Why you shouldn't add code to functions.php

BlogWhy you shouldn't add code to functions.php

Many WordPress articles and tutorials suggest you should add pieces of code to your theme's functions.php files.

While this might make sense on its face, it can have quite a few disadvantages:

Once you start adding code to functions.php, there is no easy way to organize it. You can try to delimit code snippets with comments, but once you have many scripts added, this will become hard to manage. Some people suggest splitting the functions.php into multiple files, but this can cause errors and bring your site down. A list of 20 files included in functions.php can be as hard to manage as a monolithic functions.php.

Adding code to a child theme

Theme updates can overwrite your changes, cause errors, and bring your site down. A solution for this would be to use child themes, but this can add another layer of complexity.

In case you add code that contains an error to your theme's functions.php, the site could become unusable.
To edit code, you need to use an FTP editor or the integrated WordPress code editor, both of which have limited functionality.

Adding code to a plugin

To better manage your WordPress code and offer a better alternative to adding code to functions.php, we created WPCodeBox. It provides a solution to all of the above problems and packs many extra features. If you want to give it a try, click here.

linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram