HYKEN GAMER

09 April 2025

How To Create And Upload ads.txt File To WordPress Website!

How To Create And Upload ads.txt File To WordPress Website?


Image Credits To :-https://www.freepik.com
Details on each step of adding ads.txt to a WordPress website:

📝 What is ads.txt?

The ads.txt file (Authorized Digital Sellers) is a simple, plain-text file that helps prevent unauthorized sales of your ad inventory. It tells advertisers which networks are allowed to sell ads on your site — increasing transparency and trust.


✅ Step-by-Step: How to Add ads.txt to WordPress

1. Log in to Your WordPress Dashboard

  • Go to your website’s login page (typically yourdomain.com/wp-admin).

  • Enter your username and password, then click Log In.


2. Go to Appearance > Theme File Editor

  • In the left sidebar, hover over Appearance, then click Theme File Editor (or “Editor” depending on your version).

  • This opens your active theme’s files, allowing you to make code edits.

⚠️ Always back up your site before editing theme files.


3. Open the “Theme Header” File (header.php)

  • On the right-hand panel, find and click on Theme Header (header.php).

  • You're now viewing the code that controls your website’s <head> section.


4. Add a Meta Tag to Prevent ads.txt Indexing

  • Before the closing </head> tag, paste this code:

<meta name="robots" content="noindex">
  • This tells search engines not to index your ads.txt file, keeping it private.

Click Update File after making the change.


5. Create an ads.txt File

  • On your computer, open a plain text editor like Notepad or TextEdit.

  • Name the file exactly: ads.txt


6. Add Authorized Ad Network Entries

  • Paste the information provided by your ad network(s) into the file.

  • It usually looks like this:

google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0 yournetwork.com, 123456, DIRECT, abcdef1234567890
  • Replace the publisher/advertiser ID with your own.

  • Save the file.


7. Upload the ads.txt File to Your Site’s Root Directory

You can upload the file using:

Option 1: FTP (e.g., FileZilla)

  • Connect to your server via FTP.

  • Navigate to the root directory (typically public_html).

  • Drag and drop your ads.txt file there.

Option 2: Hosting File Manager

  • Log in to your hosting account (e.g., cPanel).

  • Open the File Manager.

  • Go to the public_html folder.

  • Click Upload, then upload your ads.txt file.


8. Test Your ads.txt File

  • Open a browser and go to:
    https://yourdomain.com/ads.txt

  • You should see the content you added.

If it displays properly, you’re all set!


📌 Example ads.txt File

google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0 appnexus.com, 12345, RESELLER, f123456789abcde openx.com, 98765, DIRECT, 123456abcdef

Replace these with the actual entries from your ad partners.


🛡️ Pro Tip:

  • Keep your ads.txt file updated — if you change ad networks, update the file accordingly.

  • Use a plugin like Ads.txt Manager if you prefer not to access the root directory manually.

No comments:

Post a Comment