How to Open and Edit Your Functions.php File

As a WordPress administrator, you should know how to open and edit your functions.php file. This article looks at the occasions you might want to do that, and how to do it safely. Let’s begin with a brief introduction of this critical file and where you can find it.

WP Functions File Defined

Every WordPress install has a functions.php file in its themes folder (/wp-content/themes). Its primary purpose is to add functions and features to the active template using PHP code. The file already includes code specific to the active WordPress theme, but you can also add custom code.

Functions.php vs Plugins

Your functions PHP works like a plugin but is theme-dependent. That means each functions.php file belongs to its theme. Plugins are different as they continue to work across all active themes. So, any modifications to a functions PHP file don’t carry over if you switch to another theme.

Here are 6 examples of what your functions.php file can do.

  1. Add custom navigation menus
  2. Add profile fields to support WP authors
  3. Add widget-ready areas or sidebars to posts
  4. Customise the WordPress Admin Bar
  5. Modify your WordPress site ‘under maintenance’ message
  6. Change the behaviour of an active plugin

Add Code Snippets Using a Plugin

It’s easy to edit or modify your functions PHP files with code snippets, but there’s a warning. If the newly added code is wrong, or something gets altered by accident, it could break your site. That’s a problem if you forgot what you did or are unable to find the broken code. Get someone with experience to update this file if you’re not confident making the changes.


Log in to your WP Dashboard then go to Appearance => Theme Editor.

A warning message displays for first-time visitors to the WP Theme Editor.

Click ‘I understand’ to continue.

Confirm—or switch to—the correct theme in the Select theme to edit dropdown (top right).

Now click the Theme Functions link to the right of the Edit Themes screen.

Your next move depends on whether you need to edit existing code or add a new snippet.

How to edit existing code (advanced users only)

Functions PHP files are huge, so the fastest way to find your code is with a quick search.

Use the CTRL + F keyboard shortcut to bring up the file search box.

Type or paste part of the code into the search box, and press Enter on the keyboard.

Modify your code and click the Update File button to save the changes.

Check the site to confirm the update was successful.

How to add code snippets to the functions PHP

Click inside the file and use the keyboard shortcut CTRL + End to go to the end of the page.

Copy and paste the new code at the bottom of the file.

Click the Update File button to save the changes.

Check the site to confirm the update was successful.

Editing Functions PHP Using FTP and File Manager

The only reason to edit your WP functions.php from the web hosting server is if there are problems. For example, the file doesn’t show in the WP Dashboard. Or maybe you can’t access the Editor screen or are unable to save the theme or child theme after changing it.


FTP options for WordPress websites and blogs

You can use either the cPanel File Manager or a standalone third-party FTP client.

File path: /public_html/wp-content/themes/theme-name/functions.php

Using a third-party FTP client

  • Download a copy of the functions.php file to your computer (see file path above)
  • Rename it to copy-functions.php (this is your backup file)
  • Download another copy of the functions.php file to your computer using FTP
  • Open and edit the file in a code editor like Notepad++ from your desktop
  • Close the file and save the changes
  • Upload the modified functions.php file to your FTP server

Using the Control Panel (cPanel) File Manager

  • Open File Manager from inside your cPanel account
  • Navigate to the functions.php for your domain (see file path above)
  • Right-click and select Edit, or click the Edit link from the menu bar

The PHP file now opens in a new browser tab.

Edit your functions.php then click the Save Changes button (top right).

If something goes wrong with either method:

  • Rename the copy-functions.php you saved earlier back to php
  • Re-upload the functions.php to your web server
  • Choose OK, Replace File, or whatever confirmation prompt you get to overwrite
  • Try to fault-find the issue or get someone with more experience to help

Closing Comments

It’s not difficult to open and edit your functions PHP file, but you must be careful. Only ever add code that you know is safe and accurate. If in doubt, leave it to a professional.

Want to Learn WordPress?

WordPress is an amazing platform for building any type of website.   It’s used by large corporations and small mom & pop sites.

You may also like


1 thought on “How to Open and Edit Your Functions.php File”

  1. Hi Andy. I am assuming you can also rename the file as copy-functions instead of copy-functions.php (meaning not necessary to append .php)?

    *Also I believe there is a typo:
    “Rename the copy-functions.php you saved earlier back to php”
    I believe you meant:
    “Rename the copy-functions.php you saved earlier back to functions.php”

    Fantastic post by the way. I finished your course WordPress for Beginners on Udemy and started making my website. And now I finally know where to go to edit functions.php (ofc making sure code is safe)!

Leave a Comment

Your email address will not be published. Required fields are marked *

Hello, I'm
Andy Williams!

You can get up to 90% off my Online Courses for webmasters, marketers & affiliates (plus a free course on Gutenberg).

Create your own WordPress Theme

It's built in to WordPress using Gutenberg, and my new course shows you how.