How to Insert Code into the Head Section of Your WordPress Blog

insert-code-head

How many times have you come across something that requires you to insert code into the head section of your blog? Perhaps you need to add Google Analytics tracking code. Or maybe you want to verify your Pinterest business account. Regardless of the reason why, you’ll likely have to do this at some time or another. And while it sounds scary and confusing, it’s actually quite easy. In this tutorial, I’ll show you how to insert code into the head section of your blog so you’ll be up and running in no time!

How to Insert Code into the Head Section With the Genesis Framework

If you’re using the Genesis Framework, you’re in luck! Inserting code into the head section of your site is ridiculously easy! Go to Genesis > Theme Settings. Scroll down to the bottom and find the section titled Header and Footer Scripts. Paste your code into the first box titled Header Scripts. Click save and you’re done!

head-genesis

How to Insert Code into the Head Section Using a Plugin

Not using Genesis? That’s fine. There’s still an easy way to insert code into the head section. First, you’ll want to install the Insert Headers and Footersplugin. From the Add Plugin page, search for “insert headers and footers.” You’ll want the plugin that was created by WPBeginner, which should be the first result. Install and activate it.

header-pluginNow go to Settings > Insert Headers and Footers. Paste your code into the first box labeled Scripts in Header. Save and you’re done!

head-plugin

How to Insert Code into the Head Section of Your WordPress Theme

Now what if you’re not using Genesis and you’d rather not install another plugin? You’ll have to insert your code manually into your WordPress theme. Now keep in mind that doing so can break your site, so it’s important that you make a backup before you make any changes. Also, it’s important to note that when and if you install a theme update, your edits will be deleted and you’ll have to add them again. If you’re using a child theme, you should be okay, but if not, you might want to consider using the plugin mentioned above.

To insert the code manually into the head section of your WordPress theme, find your themes header.php file. You can find it by going to Appearance > Editor and looking for it on the right side of the screen. Or you can access it via FTP. Once you have your header.php file open, find the line with.

1 </head>

head-header-php

 

 

 

Comments

comments