In WordPress, functions.php or the theme functions file is a template included in WordPress themes. It acts like a plugin for your WordPress site that’s automatically activated with your current theme. The functions.php file uses PHP code to add features or change default features on a WordPress site.
For example, a WordPress theme might add a bit of code to the theme’s functions.php file in order to add a new widget area to the footer, or add a custom welcome message to the WordPress dashboard. The possibilities are endless!
Where Is the Functions.php File Located?
The functions. php file location is in your theme folder.
There are differences between using a plugin and a functions.php file.
A WordPress Plugin:
- Executes only when individually activated via the Plugins panel.
- Applies to all themes.
- Requires specific unique Header text.
- Is stored in wp-content/plugins, usually in a subdirectory.
A functions file:
- Executes only when in the currently activated theme’s directory.
- Applies only to that theme. If the Theme is changed, the functionality is unused.
- Requires no unique Header text.
- Is stored with each Theme in the Theme’s subdirectory in wp-content/themes.
Each theme has its own functions file, but only the functions.php in the active Theme affects how your site publicly displays. If your theme already has a functions file, you can add code to it. If not, you can create a plain-text file named functions.php to add to your theme’s directory.