WordPress powers a huge share of the web, and most of those sites could earn more from their traffic than they do. The good news: getting ads onto WordPress properly takes an afternoon, not a developer. The bad news: a few small mistakes, like a missing ads.txt file or ads stuffed into the wrong spots, can cut your earnings in half without you ever noticing.
This guide walks through the whole process in order, from getting approved to seeing your first earnings, using tools that work on any self-hosted WordPress site.
Before you start: a short checklist
- Self-hosted WordPress. You need a WordPress.org site where you can install plugins. Free WordPress.com plans do not allow third-party ad code.
- Original, useful content. Ad partners review sites before approving them. Thin, copied or auto-generated content is the most common reason for rejection. Our approval checklist covers every point reviewers check.
- Basic pages. An About page, a Contact page and a Privacy Policy that mentions advertising and cookies.
- Genuine traffic. Real readers from search, social or returning visitors. Never buy cheap traffic; see invalid traffic.
- A fast theme. Heavy themes and page builders slow pages down, and slow pages lower both rankings and ad viewability.
Step 1: Create your account and add your site
Sign up with your ad or mediation partner and add your domain. Use the exact domain your readers visit (for example example.com). Most platforms review the site before ads can serve, which usually takes from a few hours to a couple of days.
Step 2: Create your ad units
An ad unit is one position on your pages, with its own format and code. Plan them before you create them. A good starting set for a blog:
| Unit | Where it goes | Format |
|---|---|---|
| Top of article | Below the post title | Display, 728×90 or 300×250 |
| In-content | After paragraph 2–3, repeated on long posts | Display or native |
| Sidebar | Top of the sidebar (desktop) | Display 300×250 or sticky sidebar |
| Mobile anchor | Fixed at the bottom of the screen | Bottom sticky |
Give each unit a clear name like in-content-1. You will thank yourself when you compare their earnings later. More on positions in where to place ads.
Step 3: Add the ad code to WordPress
There are three reliable ways to add ad code. Pick one and stick with it.
Option A: WPCode (easiest for site-wide code)
- Install and activate the free WPCode plugin.
- Go to Code Snippets → Add Snippet → Add Your Custom Code and choose HTML Snippet.
- Paste the ad unit code from your dashboard.
- Choose where it appears: site-wide header, before or after the post content, or after a specific paragraph.
- Activate the snippet and save.
Option B: Ad Inserter (best for many positions)
- Install Ad Inserter.
- Paste each unit's code into its own block.
- Set the insertion rule for each block, for example "after paragraph 3" or "before content", and choose which post types it applies to.
- Save and check a few posts.
Option C: Theme or widget
You can paste ad code into a Custom HTML widget for the sidebar, or into your theme's template files. Use a child theme if you edit files, or a theme update will erase your changes.
Step 4: Set up ads.txt
Buyers check yourdomain.com/ads.txt before bidding. On WordPress you can:
- upload an
ads.txtfile to your site's root folder with your host's file manager, - use a plugin that manages ads.txt for you, or
- redirect
/ads.txtto a hosted file your partner keeps up to date, using a redirect plugin or your host's redirect settings.
Open the URL in a private window afterwards to confirm it loads as plain text. Our ads.txt guide explains every line.
Step 5: Make it work with caching and optimization plugins
Plugins such as WP Rocket, LiteSpeed Cache or Autoptimize speed up WordPress by delaying, combining or minifying JavaScript. Some ad code breaks when it is moved or delayed. To stay safe:
- Use an ad tag that is built to be delayed or loaded late, and that finds its ad units on the page wherever they are.
- If ads disappear after enabling an optimization feature, exclude the ad script from "delay JavaScript" or "combine JavaScript".
- Clear every cache (plugin cache, host cache and CDN) after changing ad code.
Keeping pages fast pays for itself: see page speed and ads.
Step 6: Check everything is working
- Open a few posts on desktop and on your phone. Ad spaces should appear where you placed them.
- Within a few minutes, the live activity bar on your dashboard should show that your ads are active.
- Over the next days, watch impressions, fill rate, eCPM and RPM.
Do not click your own ads to test them. Look at the page and at your dashboard instead.
Common WordPress monetization mistakes
- Too many units on day one. Start with three or four good positions, measure, then add.
- Ads inside the header or menu, where they cause accidental clicks.
- Forgetting mobile. Most readers are on phones; check every page on a real phone. See mobile ad monetization.
- Old ad scripts left behind from previous networks, slowing every page.
- No ads.txt, or one that is missing your new partner's lines.
Growing earnings after launch
- Write longer, genuinely useful articles; they hold readers and allow more in-content units.
- Update and expand posts that already get search traffic.
- Test one placement change at a time and judge it by RPM.
- Add a site at a time as your portfolio grows; our guide on scaling publisher revenue covers that stage.
Using Advorex Media on WordPress
With Advorex Media you add your site, create ad units in your dashboard and copy each unit's code. The code is designed for WordPress: it works when pasted through WPCode (including as a site-wide header snippet), Ad Inserter or a Custom HTML widget, and it keeps working with Rocket Loader, "delay JavaScript" settings and content that loads after the page. Your dashboard shows the ads.txt lines for your site and a hosted ads.txt address you can redirect to, and the Getting Started checklist walks you from adding the site to your first impression.
Key takeaways
- You need self-hosted WordPress, original content and genuine traffic.
- Plan three or four strong ad positions and add them with WPCode or Ad Inserter.
- Set up ads.txt and make sure caching and optimization plugins do not break your ads.
- Measure fill rate, eCPM and RPM, then improve one change at a time.
Frequently asked questions
How much traffic do I need to monetize a WordPress site?
There is no magic number, but ads earn in proportion to real page views. Focus on steady, genuine traffic first; a site with consistent daily visitors is in a much better position than one with occasional spikes.
Do caching and optimization plugins break ads?
They can if they delay or combine scripts that must run as written. Use an ad tag built to work with script delaying and lazy loading, and test your pages after enabling a new optimization setting.
Should I put ad code in my theme files?
It works, but theme updates can overwrite your changes. A code-snippet plugin or an ad plugin keeps your ad code safe across theme updates.
Can I use ads on a free WordPress.com site?
Free WordPress.com plans do not allow third-party ad code. You need a self-hosted WordPress site (WordPress.org) or a plan that allows plugins and custom code.
Turn these tips into revenue
Advorex Media puts several ad networks in competition for every impression on your site, with one lightweight tag and a dashboard that shows the real numbers.
Create your free account →