How to Add code to Head Tag in WordPress ?

This article provides steps and video tutorial on – How to add code to head tag in wordpress ?

Step by Step Guide

To add code to your websites head tags open your wordpress website’s admin dashboard or login if you haven’t already – you can login to wordpress by placing /wp-login.php behind your website url.

Example: mrvirk.com/wp-login.php

Now, we need to Edit – header.php file. Follow the steps below to find your header.php file

Go to –

1- Dashboard

2- Hover over – Appearance

3- Click Editor

how to add code to head tag in wordpress

4- Now an Editor Opens – Listing Several files.

5- Find and Choose header.php file
or skip steps 1 to 5 and instead place /wp-admin/theme-editor.php?file=header.php behind your domain/website url, this url will open header.php file in editor.

Example: mrvirk.com/wp-admin/theme-editor.php?file=header.php

and in case you have a WordPress Network installation this method and url will not work instead you will need to use a url like this https://mrvirk.com/wp-admin/network/theme-editor.php

6- Towards the top of the file you will see <head> tags.

Example:

head tag
Head Tag

Add your code just above the closing head tag.

Save/Update the file.

Note: If you can’t find Editor. This solution is aimed at self hosted wordpress sites (wordpress.org), if you happen to be using free wordpress.com, unfortunately they don’t allow users to access theme editor or make changes to theme files, or even allow the user to install a plugin without upgrading the plan, you should read this – WordPress.com vs WordPress.org and may want to move to a self hosted wordpress site for piece of mind.

Video Tutorial

Youtube Tutorial

Use Cases for Adding Code to WordPress Head

Most common uses cases are adding tracking pixels like Google analytics code, Google Webmasters, Yahoo Dot Tag, or to enable Adsense Page level Ads, Facebook Pixel code, or Javascript code. 

The solution in this article works for all the above use cases.

If the article, helped please show support by sharing it on social network of your choice

Related Articles

WordPress .org vs WordPress .com

Relevant Tags: how to edit head in wordpress, wordpress head, wordpress edit head, wordpress head tag, head tag wordpress, wordpress code editor, how to insert ad code in your wordpress site, add html tag to wordpress, add code to header wordpress, wordpress add code to header

Default image
Navjot Singh Virk
Navjot is a Hobby Blogger from Ireland and loves to create content to help people. He makes time on weekends to work on this blog. And has a full time position at Workday as Technical Product Manager, which he loves and thrives at. His Skills include in-depth knowledge of SEO, Javascript, Advertising, HTML, Java and Product Management. And his other hobbies include Investing, Gardening and playing Table Tennis.