There are different ways to edit WordPress files depending on which method you choose to add custom code snippets on your website.
1. Adding Custom Code in Code Snippets Plugin
If you are using the Code Snippets plugin, then you can easily add code snippets from WordPress admin area. Simply go to Snippets » Add New page to add your custom code.
2. Adding Custom Code in Site-Specific WordPress Plugin
If you are adding custom code in a site-specific plugin, then you can use the built-in WordPress plugin editor to add custom code.
First, select your site-specific plugin from the drop down menu labeled ‘Select plugin to edit’. The editor will load your plugin file, and you will be able to add code snippets in it.
Once you are done, click on the ‘Update File’ button to save your changes.
If there is something missing in your code or it has potential to break your website, then the plugin editor will automatically undo your changes.
Another method to add custom code in a site-specific plugin is by using FTP.
Simply go to the plugin folder using your FTP client. Right click on the plugin file and then select View/Edit file.
3. Adding Custom Code to functions.php or Other Theme Templates
If you are adding code snippets to your theme’s functions.php file or any other template, then you can add code directly by visiting Appearance » Editor. You can select the file where you need to add the code from the right column.
The instructions you are following will tell you where to paste the code, but if they don’t, then you need to add the code at the bottom of the file.
A better alternative way would be to use FTP to add custom code in theme files. Simply connect your FTP client to your website and go to /wp-content/themes/your-theme-folder/ and right click on the file that needs editing.
Select View/Edit file option to open the file in the text editor.