You WordPress theme does lot of functions to arrange the layout both in the frontend and backend. For example, theme needs to define a function for supporting wide and full width images offered in Gutenberg editor. Otherwise, this function will not work on your site. All theme’s functions are stored in functions.php file which is a basis for your site to work properly.
Where to Find functions.php File?
As mentioned, you can find the functions.php file in your theme’s folder. It should be in the path “/wp-content/themes/your-theme/”. Remember, each theme contains its own functions file. Hence, any modification you do on the file will be applied only to that particular theme.
Use Child Theme
The changes you make in functions.php file will be deleted, every time when you update the theme’s version. In order to keep the changes permanently, we recommend using child theme for editing functions.php file.
How to Edit functions.php File?
- Login to your WordPress admin panel and navigate to “Appearance > Theme Editor” section. When you are in Theme Editor, WordPress will show you a warning message not to edit theme files. As mentioned, use child theme for editing the files.
- Select your active theme from the dropdown. In our example, we select Twenty Twenty. Make sure to select your active theme.
- Find and click on “functions.php” file from the “Theme Files” right sidebar.
- Add your functions at the end of the file.
- Click “Update File” button to save the changes.
FTP and File Manager
If you use security plugins, Theme Editor will be disabled for security reason. In this case, you will not find the Theme Editor menu item under “Appearance” section. You can use FTP or File Manager app in your hosting account to browser and functions.php file. You need to find the file under “/public_html/wp-content/themes/your-theme/” folder. If you installed WordPress in subdomain or subdirectory then try to find the file under “/public_html/directory/wp-content/themes/your-theme/”.