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

Video Tutorial

Step by Step Guide

Open your WordPress Website Dashboard

or login if you haven’t already – you can login to wordpress by placing /wp-login.php behind your website url.


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

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


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


head tag
Head Tag
<head> (opening tag)

some lines of code

</head> (closing tag)

Add your code just above the closing head tag.

Save/Update the file.

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

What is head tag ? 

Enabling auto ads to generate additional revenue

How to add code to head in WordPress
How to add code to head in WordPress ?


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.