There are three popular ways to add a piece of code to your WordPress site:
The most common approach is to add the code to your theme's functions.php
file.
You can do this in Appearance → Editor.
More information about the functions
file.
Instead of putting everything in functions.php
, you can create a basic plugin
that contains your custom code. This way you won't lose your customizations when you change
or upgrade your theme.
This plugin provides an easy way to add and organize code snippets without having to edit any files. It also supports code import & export.