How to add an Ad Tag to <head> section in WordPress
How to Add an Ad Tag to the <head> Section in WordPress
Adding an Ad Tag to the <head> section of your WordPress site is crucial for optimizing ad placements and enhancing monetization. This step-by-step guide will walk you through the process, ensuring you can do it effortlessly.
TL;DR
To add an Ad Tag to your WordPress site, request the tag from your Account Manager and choose one of three methods: using a plugin, editing a theme template, or utilizing a WP hook.
Step 1: Request Your Ad Tag
- Request an Ad Tag from your Account Manager or obtain it from the EZmob Dashboard.
a. Log in to the EZmob Dashboard.
b. Select the Placements tab and click on GET PLACEMENT.

c. Click on COPY CODE to copy the Ad Tag to your clipboard.

Step 2: Choose Your Method of Insertion
You have three options for adding the Ad Tag to the <head> section of your WordPress site:
- Use a Plugin
- Edit a Theme Template
- Use a WP Hook
Select the method that you find most comfortable. Below, we will describe each option in detail.
Method 1: Use a Plugin
For beginners, using a plugin is the easiest and most recommended method.
Head, Footer and Post Injections
- This free WP extension allows you to add code to the
<head>section.
Steps to Follow:
- Install the Plugin from the WordPress plugin repository.
- After activation, navigate to Settings > Header and Footer in the admin panel.
- Go to the Head and Footer tab.

- In the <HEAD> section injection block, you will find two text fields:
- The first field applies the code to all pages of the site.
- The second field adds code only to the main page of the WP site.

Method 2: Edit a Theme Template
If you prefer not to install additional plugins, you can manually add the code to the desired template of your WordPress theme.
Steps to Follow:
- Navigate to the wp-content/themes directory and locate the header.php file.
Warning: It is not recommended to modify the parent WordPress theme files. Use a child theme to make edits without losing them during updates.
- The contents of the header.php file may vary by theme, but the main blocks are similar. For example, in the standard Twenty Twenty WP theme, you will find the <head>…</head> block at the beginning of the file.

- Add the required code before the closing
</head>tag.

Method 3: Use WP Hook
WordPress provides a special hook that allows you to add code to the <head> section.
Steps to Follow:
- Open the functions.php file, which is located in the root of your theme's folder. For example, for the Twenty Twenty theme, it is located at:
/wp-content/themes/twentytwenty/functions.php
- To add an Ad Tag to the site header, paste the following code at the end of this file:
function wpplus_insert_header() {
?>
<!-- An Ad Tag -->
<?php
}
add_action( 'wp_head', 'wpplus_insert_header' );
Replace <!-- An Ad Tag --> with the Ad Tag you copied in Step 1.
Conclusion
Choose the method that best suits your needs—whether it's using a plugin or editing the theme manually—and start optimizing your earnings with EZmob monetization solutions.
#
Related Articles
- How to set up EZmob Header bidding banners on the WordPress platform
- How to add an ad tag to <head> section in Blogger platform
- EZmob Publisher : Getting Started
- Getting Started & Account Setup
- How to Create Your EZmob Advertiser Account
Updated on: 04/11/2025
Thank you!
