Functions.php is a core file included in every WordPress theme, acting much like a plugin that's specific to that particular theme. It's where custom PHP code goes to add features, modify default WordPress behaviour, or hook into other parts of the system, without needing to touch WordPress's own core files.
Common Things Added There
- Registering custom navigation menus
- Enqueuing additional CSS and JavaScript files
- Defining custom widget areas
- Adjusting default WordPress behaviour through action and filter hooks
- Adding support for theme features like featured images
A Word of Caution
A single syntax error in functions.php can bring down an entire site — a risk worth taking seriously. Editing directly through a child theme, keeping a recent backup on hand, and testing changes on a staging site first are all sensible habits before touching this file on a live site.
An Example
Adding `add_theme_support('post-thumbnails');` to functions.php turns on support for featured images throughout a theme — a small, single line producing a meaningful piece of added functionality, which captures the general spirit of what this file is for.
« Back to Index