Written by on

Functions: in Theme’s functions.php or in a Functionality Plugin?

Almost every major WordPress theme you install will come with a functions.php file. You can put all your custom functions and code in that file.

Putting all custom coding in the theme’s functions.php allows you to put everything in one place, and to make your theme kind of like the central place to hold such functions.

But is that the best place to put your custom functions in?

WPCandy does not think so. WPCandy recommends that instead of using your theme’s functions.php file, you use a Functionality Plugin instead.

A functionality plugin is basically a simple plugin with all your custom functions in it..

What is a Functionality Plugin?

Functions.php file in a theme or a Functionality plugin?

Functions.php file in a theme or a Functionality plugin?

A Functionality Plugin is basically a very simple plugin which has all your custom code in it.

When you activate this plugin, all your custom code will be live. When you deactivate this plugin, all your custom code will stop working.

Here are some benefits of using a functionality plugin:

  1. Your custom code does not depend on the theme.
  2. You can switch themes without worrying about your functions.php file.
  3. You can have multiple functionality plugins, enabling and disabling each custom code function as you wish.
  4. You can enable and disable functions easily via WordPress. You don’t have to edit the functions.php file anymore.
  5. You start treating your custom code like a plugin, which it basically is.

In the end, it may boil down to your preference. Both methods work and produce the same exact effect on the front-end.

Which method is better?

Is putting all your custom functions in a functionality plugin better?

Or should you put everything in the theme’s functions.php file so that the theme can take care of loading those functions properly?

What do you think? And which method do you prefer?

Share your answers in the comments below. Thanks for reading!



Sale ends Nov. 30! Save 50% OFF our entire library of WordPress tools Get the coupon