- Add to Functions.php File (or, better yet, Create a Child Theme)
- Create a Site-Specific Plugin
- Use a Code Snippets Plugin
Note: When adding any kind of custom code to your site, it’s important to preserve your code from unexpected events. So no matter what approach you choose, it’s a good idea to always back up your site. That way, you’ll have access to older versions of code files if needed.