Some of our documentation or tutorials may ask you to add a code snippet to your site to alter the behavior of our plugins. There are two recommended ways to do this:

1. Via the functions.php file

If you know your way around WordPress and are not afraid to edit theme files, this option is preferred.

If you are using a commercial theme, you should have created and activated a child theme. This will allow you to add new code and modify the parent theme without the fear of your changes getting lost the next time the parent theme is updated.

So if you have a child theme active, the best way to add code snippets is through the child theme’s functions.php file. You can edit this file through FTP (preferred) or via the WordPress dashboard Appearance > Theme editor.

You should add code snippets to the bottom of that file. If the bottom of your functions.php file has a line that has ?>, then you should add the code snippet right before that line.

2. Via a plugin

You can install a plugin specifically designed to allow you to add snippets. The advantage of this is that you don’t need to edit theme files. Instead, you can add the snippets directly from your WordPress dashboard. We recommend using the free Code Snippets plugin.