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

How To Create And Upload ads.txt File To WordPress Website?
Details on each step of adding ads.txt to a WordPress website:
  • Log in to your WordPress dashboard: Go to your website’s login page and enter your username and password.
  • Go to Appearance > Editor: This will take you to the WordPress editor where you can access your theme files.
  • From the right-side menu, select the “Theme Header” (header.php) file: This file controls the header section of your website and is where you’ll add the meta tag to prevent search engines from indexing your ads.txt file.
  • Paste the following code into the header.php file, just before the closing </head> tag:- php
<meta name="robots" content="noindex">

          This meta tag tells search engines not to index the ads.txt file, keeping it private and secure.

  • Create a new file named “ads.txt”: This file will contain the information provided by your ad network. It should be plain text and follow the IAB’s standard format.
  • Add the content that your ad network has provided you with to the ads.txt file: This information will tell advertisers which ad networks are authorized to sell your inventory. The format will look something like this:-
domain.com, network1.com, advertiser-id, type
domain.com, network2.com, advertiser-id, type
  • Upload the “ads.txt” file to the root directory of your website: This can be done using an FTP client, such as FileZilla, or the File Manager in your hosting account.
  • Test the file to make sure it’s working: You can do this by visiting yourdomain.com/ads.txt. If everything is set up correctly, you should see the contents of your ads.txt file.

Note:- It’s always a good idea to backup your site before making any changes to the code, just in case anything goes wrong.

Example:-

Note:- Take Each line of your Publisher ID/advertiser ID Paste it in your ads.txt files.Here your ads.txt file should now look like this, where pub-0000000000000000 is your own publisher ID/advertiser ID:

google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0

domain.com, network1.com, advertiser-id, type
domain.com, network2.com, advertiser-id, type