Skip to content

How to Add an Ads.txt File in WordPress (3 Ways, and What the Line Actually Means)

How to add an ads.txt file in WordPress and clear the AdSense Earnings at risk warning, three ways, with the exact line to paste and how to check it worked.

Sunny Kumar
Sunny Kumar7 min read
TL;DR

To add ads.txt in WordPress, put a plain text file called ads.txt in your site's root so it loads at yourdomain.com/ads.txt. The fastest way is the free Ads.txt Manager plugin: install it, go to Settings then Ads.txt, and paste your AdSense line (google.com, pub-XXXX, DIRECT, f08c47fec0942fa0). No plugin? Create the file in your host's File Manager or upload it by FTP. Once it is live, AdSense clears the "Earnings at risk" warning within a day or two.

The first time I saw the "Earnings at risk" banner in AdSense, it looked worse than it was. One red line, a countdown feeling, and a file I had never heard of.

It turned out to be a two-minute fix.

AdSense wants a small text file called ads.txt sitting in your site's root, listing who is allowed to sell ads on your domain. No file, and Google flags your inventory as unverified.

I have set this up on plenty of WordPress sites since. Here is the exact line to paste, three ways to put it live, and the part most guides skip: what that line actually means.

What is ads.txt, and why does AdSense keep warning you?

ads.txt stands for "authorized digital sellers". It is a public list of the ad companies you have allowed to sell ad space on your site.

The point is fraud protection. Without it, a scammer can claim to sell your inventory on shady exchanges, and buyers have no way to tell fake from real. The file lets Google and every ad buyer check the list and ignore anyone not on it.

That is why AdSense shows "Earnings at risk".

It is not a penalty, and you did nothing wrong. Google just cannot yet verify who sells your ads, so it holds back demand until you publish the file.

What does each line in ads.txt actually say?

This is the bit that trips people up. Every line is one ad network, written as four values separated by commas. Get one wrong and the whole line is ignored.

Diagram breaking down an AdSense ads.txt line into its four fields: google.com, publisher ID, DIRECT, and certification ID
The four fields in an AdSense ads.txt line. The publisher ID is the one people get wrong.

For Google AdSense, the line looks like this:

google.com, pub-1234567890123456, DIRECT, f08c47fec0942fa0
  • google.com: the ad system. For AdSense this is always google.com.
  • pub-...: your publisher ID, pulled from your AdSense account. This is the only part that changes per site.
  • DIRECT: your relationship with the network. DIRECT means you deal with Google yourself; RESELLER means a third party sells on your behalf.
  • f08c47fec0942fa0: Google's certification ID in the ads.txt system. Always this exact string for AdSense.

Three of the four values are fixed. The only one you supply is your publisher ID, so copy that one carefully.

Where do I find my exact AdSense line?

Do not guess the publisher ID, and never copy it from a guide. Get the real line straight from Google.

In your AdSense account, open Sites. When ads.txt is not verified you see the "Earnings at risk" banner and a Create an ads.txt file card, with a Download button that hands you the file already filled in for your account.

Google AdSense Sites screen showing the Earnings at risk banner and a Create an ads.txt file card with a Download button
AdSense generates your ads.txt for you. Download the file, or copy the line it shows, so your pub- ID is exactly right.

Use that line as-is. It already has your pub- number baked in, so there is nothing to type by hand and nothing to mistype.

If you run more than one ad network, you will add one line per network. AdSense first, then any others, each on its own line.

Three ways to add ads.txt to WordPress

WordPress has no built-in "upload ads.txt" button, so you add the file one of three ways. Pick by how comfortable you are touching files.

MethodBest forTouches files?
Plugin (Ads.txt Manager)Almost everyoneNo
Host File ManagerNo plugin, has cPanel accessYes, in the browser
FTP clientComfortable with FileZillaYes

For nine sites out of ten, I use the plugin. It is the least error-prone, and it keeps the file out of harm's way when you change hosts or themes. One small plugin like this will not slow your site down either.

Method 1

Add ads.txt with the Ads.txt Manager plugin

Best for: Almost everyone — no file access needed

The free Ads.txt Manager by 10up writes a virtual ads.txt for you, so you never open a file manager. It is the one I reach for first, and it sits comfortably next to the other plugins I install on every WordPress site.

4.7/5100,000+ installsFreeTested to 7.0on WordPress.org
The Ads.txt Manager plugin editor in WordPress, under Settings then Ads.txt, with a Google AdSense line pasted in
Ads.txt Manager adds a simple editor under Settings, Ads.txt. Paste your lines and save.

Step 1

Install and activate the plugin

In your dashboard go to Plugins, Add New, search for "Ads.txt Manager" by 10up, then click Install and Activate.

Step 2

Open the editor

Go to Settings, Ads.txt. You get a plain text editor titled "Manage Ads.txt".

Step 3

Paste your line and save

Paste the line you copied from AdSense, add any other networks below it, and click Save Changes. The plugin validates the format and warns you if a line is malformed.

That is it. The file goes live instantly at yourdomain.com/ads.txt, and there is no physical file to lose later.

Method 2

Add ads.txt without a plugin, via File Manager

Best for: No plugin, and your host has cPanel

If you would rather not add a plugin, you can create the file directly in your hosting File Manager. This is the top "without plugin" method people search for, and it is genuinely simple.

cPanel dashboard with the Files section open and File Manager highlighted
In cPanel, the File Manager lives under the Files section.

Step 1

Open File Manager and go to the root

In cPanel (or your host's panel), open File Manager and navigate to public_html. That is your site's root, the same folder that holds wp-config.php.

Step 2

Create the file

Click + File, name it exactly ads.txt in lowercase, and create it in public_html, not in a subfolder.

Step 3

Edit, paste and save

Right-click the file, choose Edit, paste your ads.txt lines, and save. Make sure it saves as plain text.

The catch: if you later move hosts, this physical file does not travel with your WordPress export, so you will recreate it. That is the one reason I lean plugin.

Method 3

Add ads.txt via FTP

Best for: You already use FileZilla or similar

Same idea as the file manager, done from your computer. Useful if your host has no File Manager or you already work over FTP.

Step 1

Create the file locally

In a plain text editor (Notepad, TextEdit in plain-text mode, or VS Code), create a file named ads.txt and paste your lines. Do not use Word.

Step 2

Connect and upload to the root

Connect to your site with FileZilla, open the public_html folder, and drag ads.txt into it.

Step 3

Confirm it uploaded

Check the file appears in the root, then verify it in a browser (next section).

How do I check my ads.txt is actually working?

Never assume it worked. Confirm it two ways.

Load it in a browser. Go to yourdomain.com/ads.txt directly. You should see your lines as plain text. A 404 means the file is in the wrong folder, almost always a subfolder instead of the root.

A browser showing yourdomain.com/ads.txt with a valid google.com AdSense line displayed as plain text
A working ads.txt loads as plain text at yourdomain.com/ads.txt. If you get a 404, the file is in the wrong folder.

Wait for AdSense to re-check. Once the file loads correctly, the "Earnings at risk" warning clears on Google's own schedule, usually within a day or two. You cannot force it, so give it 24 to 48 hours before worrying.

If the warning lingers after that, re-read the line character for character. A mistyped pub- number is the single most common reason a correct-looking file still fails.

What lines do other ad networks need?

If you use a network other than AdSense, add its line too. Each network publishes its own required entries; here is where to find them.

NetworkWhere to get your lines
Google AdSenseAdSense, Sites, copy the ads.txt line
EzoicEzoic dashboard, ads.txt settings (or use their integration)
MediavineYour Mediavine dashboard under ads.txt
Raptive (AdThrive)Provided by your Raptive account manager
Media.netMedia.net publisher dashboard

Always paste the exact block your network gives you. These lists change as networks add partners, so copy fresh rather than reusing an old block from a guide.

What about app-ads.txt?

app-ads.txt is the same concept for mobile apps rather than websites. If you monetize an Android or iOS app, you publish it the same way, in your root.

For a normal WordPress site with no companion app, you can ignore it. Plain ads.txt is all you need.

Ads showing, but the site is slow to load them?

A slow WordPress site hurts ad viewability and your Core Web Vitals at the same time. If your pages are heavy or your setup feels fragile, I can harden the build so ads load fast and clean.

See WordPress development

Final take

ads.txt is a two-minute job that looks scarier than it is. Get your exact line from AdSense, put the file in your site's root by whichever method suits you, and confirm it loads at yourdomain.com/ads.txt.

The plugin is the safest route for most people. The file manager and FTP methods do the same thing by hand.

Once the file is live and correct, the "Earnings at risk" warning clears on its own. If it does not, the fix is nearly always a mistyped publisher ID, so check that line first, character for character.

Common questions

How do I add ads.txt in WordPress without a plugin?

Create a plain text file named ads.txt (all lowercase), paste your authorized-seller lines into it, and upload it to your site's root folder, usually public_html, using your host's File Manager or an FTP client like FileZilla. It must load at yourdomain.com/ads.txt.

Where is the ads.txt file located in WordPress?

In the root of your domain, not inside a theme or the wp-content folder. It has to be reachable at yourdomain.com/ads.txt. On most hosts that means the public_html directory. A plugin writes it there virtually so you never touch files.

How long does it take for the AdSense "Earnings at risk" warning to clear?

Usually within 24 to 48 hours after your ads.txt file is live and correct. Google re-crawls the file on its own schedule, so you cannot force it. Confirm the file loads in your browser first, then wait a day or two.

Do I need an ads.txt file if I do not use AdSense?

Only if you run programmatic display ads through any network, such as Ezoic, Mediavine, Raptive or Media.net. Each one gives you a line to add. If you run no display ads at all, or only affiliate links, you do not need ads.txt.

Why is my ads.txt not working or still showing an error?

The three usual causes: the file is in a subfolder instead of the root, the publisher ID does not match your AdSense account exactly, or the file did not save as plain UTF-8 text. Load yourdomain.com/ads.txt in a browser and check the line character for character.

What is app-ads.txt and do I need it?

app-ads.txt is the same idea for mobile apps instead of websites. You only need it if you monetize an Android or iOS app. For a normal WordPress site with no companion app, plain ads.txt is all you need.

Written by
Sunny Kumar
Sunny KumarSEO Specialist & product builder

SEO Specialist and product builder with 10+ years in search. The notes come from the work, not the theory.

Work with TheGuideX

Reading about it is the easy part.

Send us the site and the problem. Your first reply comes from Sunny Kumar — not a sales team — and tells you if it is a fit.