1. Documentation /
  2. How to use theme functions.php

How to use theme functions.php

One method of making changes to your site using code snippets is through the use of the theme functions.php file. From the WordPress Codex:

The functions file behaves like a WordPress Plugin, adding features and functionality to a WordPress site. You can use it to call functions, both PHP and built-in WordPress, and to define your own functions.

Note: We are unable to provide support for customizations under our Support Policy. If you need help with the instructions on this page or resolving potential conflicts, contact a WooExpert.

Editing functions.php

Most themes include the functions.php file in the main directory, e.g., Twenty-Twelve theme has one under wp-content/themes/twentytwelve/functions.php.

Because this file needs to contain PHP code, it should start with an opening PHP tag:


Any custom functions can be placed below this, but ensure there are no extra <?php tags when you’ve pasted your snippet!

We recommend to never use the editor in WP Admin to edit functions.php. If you make a mistake you may be unable to correct it if the admin area cannot load due to an error. Instead use and an FTP client or your host’s file manager.

  1. Download the theme functions.php file to your computer from the theme directory using an FTP client.
  2. Make changes using a simple text editor, such as Notepad or a code editor.
  3. Upload the modified file back to the theme directory using your FTP client.


↑ Back to top

To troubleshoot any errors after adding code, you can temporarily enable WP_DEBUG mode to see what has gone wrong and correct mistakes.

Child themes

↑ Back to top

To keep changes safe from theme updates, it is recommended that you create a child theme with its own functions.php instead of editing the parent theme. The theme vendor may have additional instructions on how to do this in their documentation.

Related reading

↑ Back to top


The most customizable eCommerce platform for building your online business.

  • 30-day money-back guarantee
  • Support teams across the world
  • Safe and secure online payment