- Install the Insert Headers and Footers plugin.
- Go to Settings > Header and Footer Scripts.
- Paste the code snippet into Scripts in the header textbox.
- Click Save Settings.
Alternative Method
- Navigate to Appearance > Theme Editor
- Click the Theme Header (header.php) file on the right-hand side below the Theme Files section.
- Paste the code snippet before the closing </head> tag.
- Click Update File