There are very less customizations that you can do on WordPress websites without editing the functions.php file of your active theme. This is because every function and filter is defined in this file. And if you are a newbie, you won’t know how you could edit this file. I will show you two ways of editing the functions.php file, one is from WordPress dashboard, and the other one is by using a FTP client.
Editing Functions.php File From WordPress Dashboard
- Login to your website’s WordPress admin area.
- From the left pane, navigate to “Appearance > Editor“
- All the important files from the active theme’s directory will be listed in the right sidebar. Click on “functions.php“.
- As soon as you click this, the page will refresh and you will be able to edit your theme’s functions.php file.
Things to remember
- Make sure the code you add is from a reliable source and is free of errors. Adding erroneous code to your functions.php file can break your website completely.
- The editor that you get in WordPress does not show any errors of any kind. Check your code for any errors with some PHP editor. Using Notepad++ (free) or DreamWeaver (paid) is a good option.
- Every function you need to add goes before the last “?>“, which marks the ending of PHP code.
What After You Break Your Website
If you ever break your website while editing the functions.php file, then you will not be able to reach the WordPress admin area. For a quick solution, you can login to your hosting control panel and edit the functions.php file using the file manager. The file is usually located at “public_html/wp-content/themes/your_theme_name/functions.php” on shared hosting, and “/var/www/wp-content/themes/your_theme_name/functions.php” on Virtual Private Servers.
TIPInstead of using your hosting control panel, use a FTP client like FileZilla. You can easily edit, download and upload files using a FTP client than you would do in your browser. This also gives you the flexibility of using any text editor of your choice.
Using FileZilla To Edit functions.php File
- First download and install FileZilla
- Go to “File > Site Manager”
- Enter all your hosting details, viz., Host, Port number, User ID and Password. Then click the “Connect” button to login.
- Search for the “functions.php” file on the right pane and download it on your PC.
- After editing the file, upload it back to your server and overwrite the existing file.
I use Adobe DreamWeaver to edit my theme files. It connects to my Web Server directly and uploading and downloading files becomes just a matter of few clicks. If you don’t want to buy a paid product for this, then Notepad++ and FileZilla can get the job done.