If you are getting the warning message in your AdSense console regarding your ads.txt file and earnings at risk there can be a couple of solutions you can try to resolve it.
Typically, Adsense will show you the message as follows:
Earnings at risk – You need to fix some ads.txt file issues to avoid severe impact to your revenue.
Another Message that you may see in the Adsense console:
Earnings at risk – One or more of your ads.txt files doesn’t contain your AdSense publisher ID. Fix this now to avoid a severe impact on your revenue.
To prevent severe impact on revenue, download an ads.txt file then upload the file to the root level domain of each site:
Now there is a link to download the text file and you can upload it in the root directory of your website.
For WordPress, you can simply download the file and upload it to the public_html folder where you also have other files like Wp-Config, etc. You will have to use a client like Win-SCP or Filezilla to upload the file.
If you are not comfortable uploading the file, you can use a plugin to fix this issue.
First and foremost if you are using a CMS like WordPress you can download the Ads.txt Manager Plugin that is available for free.
Next, copy and paste the contents of your ads.txt file that you have downloaded
The content looks like this – google.com, pub-363434349433445212, DIRECT, j08f56ase09765a1
Just copy the contents of the Ads.txt file that you have downloaded in the plugin and hit save.
That’s all you have to do, to get rid of the error.
How to Check if your Ads.txt file is working properly?
You can type in a browser – yourwebsite.com/ads.txt and you will see the contents of your ads.txt file. If you see a 404 or any other message then there is some issue with the ads.txt file.
Sometimes, even if you have an ads.txt file or plugin active Google may show this message. In such cases, you need not worry and ignore it. Google will re-crawl your website and it will go away in a couple of days.
Further Reading – Google also has directives and some supporting notes on using the Ads.txt file – can read here.