Setup & site building · Guide
How to Add Ads.txt File in WordPress (Step by Step)

Short answer
To add ads.txt in WordPress, copy the ads.txt line from your ad network, such as AdSense. Paste it into an ads.txt plugin like Ads.txt Manager, or save it in a plain text file and upload it to your root folder next to wp-config. Then open yourdomain/ads.txt in a browser to confirm it loads.
Key takeaways
- Ads.txt lists the companies allowed to sell ads on your site.
- It must load from the root of your domain.
- A plugin serves the file without touching server folders.
- Manual upload goes to the folder that holds wp-config.php.
- AdSense can take a few days to detect a new file.
How do you add an ads.txt file in WordPress?
Copy the ads.txt line from your ad network, then either install an ads.txt plugin and paste it in, or create a plain text file named ads.txt and upload it to your site's root folder.
The file must load at yourdomain.com/ads.txt. Ad networks and buyers check that exact address, so a copy in a subfolder or on a different subdomain does not count.
WordPress does not create ads.txt for you. Unlike robots.txt, there is no virtual version built into core, so you add it with a plugin or upload it yourself.
Both methods take a few minutes. A plugin is easier if you do not want to touch server files.
Before you start, log in to your ad account and find the exact ads.txt line it wants. Typing it by hand invites typos in the long publisher ID, and a single wrong digit makes the record useless.
It also helps to know who your host is and how to reach its File Manager. Even if you choose the plugin route, you may need server access later to check for an old file left behind.
What is an ads.txt file and why do you need it?
Ads.txt is a public text file listing the companies allowed to sell ad space on your site, which helps stop fake inventory and lets ad networks trust your traffic.
The standard comes from the IAB Tech Lab, which publishes the ads.txt specification. The name stands for Authorized Digital Sellers.
Google AdSense strongly recommends it. Without a valid file, AdSense may show a warning in your account, and you can lose revenue because some buyers skip unverified sites.
Google's help page on ads.txt for AdSense explains the warning and how to fix it. If you are still applying for AdSense, our guide on getting approved for AdSense with WordPress covers the steps before ads.txt matters.
What goes inside an ads.txt file?
Each line lists an ad system's domain, your publisher account ID, the relationship type DIRECT or RESELLER, and an optional certification authority ID, separated by commas.
A typical AdSense line looks like this:
google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0
Replace the pub- number with your own publisher ID. The safest way is to copy the full line from your AdSense account, which shows a ready-made snippet when it flags a missing file.
If you work with several ad networks, add one line per account. Networks like Ezoic, Mediavine or Raptive often give you a long list, or ask you to redirect your file to theirs.
| Part | Example | Meaning |
|---|---|---|
| Ad system domain | google.com | The ad platform's domain |
| Publisher ID | pub-0000000000000000 | Your account with that platform |
| Relationship | DIRECT or RESELLER | You control the account, or a partner resells |
| Certification ID | f08c47fec0942fa0 | Optional ID for the ad system |
Lines starting with # are comments and are ignored. Keep each record on its own line.
You can also add a few optional variables, such as a contact line, which some networks ask for. These are not required for AdSense.
Do not paste your ad code or JavaScript into ads.txt. The file only holds plain records, and anything else can make parsers ignore it.
How do you add ads.txt with a plugin?
Install an ads.txt plugin such as Ads.txt Manager, open its settings screen, paste your ad network lines into the box, and save; the plugin then serves the file at your root address.
- Go to Plugins > Add New and search for ads.txt.
- Install and activate a well-reviewed plugin. Ads.txt Manager is a popular free option.
- Open its settings, usually under Settings > Ads.txt.
- Paste the line or lines from your ad network.
- Save, then visit
yourdomain.com/ads.txtto confirm it loads.
Plugins create the file dynamically, much like WordPress handles robots.txt. That means no file sits on your server, and you edit it from the dashboard.
Some ad management plugins, such as Advanced Ads, also include ads.txt settings. If you already use one, check its settings before adding another plugin. Our guide on adding ads to WordPress covers ad placement plugins.
How do you upload ads.txt manually?
Create a plain text file named ads.txt with your ad lines, then upload it to your site's root folder, usually public_html, using your host's File Manager or an FTP client.
- Open a plain text editor such as Notepad or TextEdit in plain text mode.
- Paste your ad network lines and save the file as ads.txt. Make sure it is not saved as ads.txt.txt.
- Log in to your hosting panel and open the File Manager, or connect with FTP.
- Go to the folder that contains
wp-config.phpandwp-content. That is your WordPress root. - Upload ads.txt there.
- Visit
yourdomain.com/ads.txtin a browser to check it.
The root folder name depends on your host. It is often public_html, www or htdocs.
If WordPress sits in a subfolder, the file still needs to go to the domain's top-level folder, not the WordPress subfolder. Our guide on finding wp-config.php helps you locate the right folder.
Should you use a plugin or upload the file?
A plugin is easier to edit and survives most hosting changes, while a manual file has no plugin overhead and keeps working even if WordPress has problems.
If both exist, the real file on the server usually wins, because the web server serves it before WordPress loads. Use one method only to avoid confusion.
How do you check that ads.txt is working?
Open yourdomain.com/ads.txt in a private browser window; you should see your lines as plain text with no HTML, error page or redirect to another address.
Look for these signs of a working file:
- The page shows only your text lines.
- The address stays on your main domain over HTTPS.
- Your publisher ID matches the one in your ad account exactly.
- There are no extra spaces or odd characters at the start of lines.
Then check your ad account. AdSense crawls ads.txt on its own schedule, so the warning can take a few days to clear. Google's developer page on ads.txt for AdSense describes how the crawler checks the file.
Why is my ads.txt file not found?
Ads.txt usually fails because it sits in the wrong folder, a redirect moves it to another domain, a cache serves an old 404 page, or a security plugin blocks text files.
Work through these checks:
- Wrong folder: Upload it to the domain root, next to wp-config.php.
- www versus non-www: The file should load on the version of your domain that ads run on. Redirects between www and non-www are fine if they stay on the same root domain.
- Caching: Clear your caching plugin, host cache and CDN. Our guide on purging LiteSpeed Cache covers one common setup.
- Server rules: Custom rules in .htaccess can block or redirect plain text files. Our guide on editing the .htaccess file explains how to check them safely.
- Wrong file name: It must be lowercase ads.txt with no extra extension.
If you recently moved hosts or domains, confirm the file moved too. Manual files are easy to forget during a migration.
Does ads.txt work on subdomains and WordPress.com?
Ads.txt belongs on the root domain, so a blog on a subdomain usually relies on the main domain's file, and hosted platforms may handle ads.txt for you or limit access to the root folder.
If your WordPress site is at blog.example.com, the ad network typically checks example.com/ads.txt. You may need to add your lines to the main domain's file.
WordPress.com and some managed hosts restrict direct file access. Check your plan's documentation, since some plans include ad programs that manage the file automatically.
What should you do after adding ads.txt?
Keep the file updated whenever you add or remove ad partners, check it after migrations and redesigns, and watch your ad account for new warnings.
Remove lines for networks you no longer use. Outdated entries do not usually break ads, but a clean file is easier to manage.
Some ad networks update their lines often. If they offer an automatic redirect or managed file, consider using it.
Set a reminder to view the live file every few months. Plugins can be deactivated during troubleshooting and forgotten, which quietly takes the file offline.
If you run several sites, keep a simple list of which ad accounts each one uses. That makes it easy to spot a missing or outdated line when a network sends a warning.
Finally, make sure ads do not hurt your visitors. Heavy ad scripts slow pages down, and our guide on optimizing WordPress speed helps keep load times in check.
Frequently asked questions
Where do I put ads.txt in WordPress?
Put it in your domain's root folder, the same folder that holds wp-config.php and wp-content, often called public_html. It must load at your domain followed by /ads.txt, not inside a subfolder.
Do I need a plugin for ads.txt?
No. You can upload a plain text file to your root folder with File Manager or FTP. A plugin is simply easier if you want to edit the file from the dashboard without touching server files.
How long does AdSense take to find my ads.txt file?
It can take several days. AdSense crawls the file on its own schedule, so the warning may stay for a while after you fix it. Confirm the file loads correctly in a browser and give it time.
What should my AdSense ads.txt line say?
It lists google.com, your publisher ID starting with pub-, the word DIRECT, and Google's certification ID. Copy the exact line from your AdSense account rather than typing it yourself to avoid mistakes.
Why does my ads.txt show a 404 error?
The file is probably in the wrong folder, has the wrong name, or a cache is still serving an old error page. Check it sits next to wp-config.php, is named ads.txt in lowercase, and clear all caches.
Sources
- Ads.txt guide Google AdSense Help
- ads.txt for AdSense Google for Developers
- ads.txt specification IAB Tech Lab
- Ads.txt Manager WordPress.org Plugin Directory
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
Related guides
About the editors
Researched from the primary sources listed above and checked against our editorial rules before publishing.


