Using a plugin is more beginner-friendly when it comes to adding snippets. You can easily control what bits of code you enable on your website and any code you add will be saved even if you change your theme. Additionally, you can activate or deactivate any code at any point.
In this case, we’ll be using the
Code Snippets plugin. It’s one of the most popular plugins to add custom code to any site.
First, install the plugin by opening your
WP Admin Dashboard and going to
Plugins > Add New. Use the search bar on the top right and search for
Code Snippets. Then, click
Install and finally
activate the plugin.