Skip to content

How to Add AdSense to WordPress (2026): Site Kit, Auto Ads and ads.txt

Adding Google AdSense to a WordPress site takes about 15 minutes once your account is approved. The easiest way is Google's free Site Kit plugin, which places the code for you. This guide covers Site Kit, the manual method, ads.txt and the settings that make a real difference to earnings.

Short version: get your site approved in AdSense, install Site Kit by Google, connect AdSense, let Site Kit place the code, then turn on Auto ads in your AdSense account. Check that your ads.txt file is live and, if you have visitors in Europe, set up a Google-certified consent message first.

Before you start

Method 1: Site Kit by Google (recommended)

  1. In WordPress go to Plugins, then Add New, and search for Site Kit by Google. Install and activate it.
  2. Click Start setup and sign in with the Google account that owns your AdSense account.
  3. In Site Kit, open Settings and click Connect service next to AdSense.
  4. Let Site Kit place the AdSense code on your site. Google recommends this, and it works on normal and AMP pages.
  5. In your AdSense account, go to Ads and turn on Auto ads for your site. Site Kit cannot change AdSense settings for you, and without Auto ads or ad units no ads appear.

If you have visitors in Europe, Google suggests not showing ads straight away, so you can set up a consent message first.

Method 2: Add the code yourself

  1. In AdSense, go to Ads, then By site, and copy the AdSense code.
  2. Paste it into the <head> of your site, using your theme's header settings or a header and footer plugin. Avoid editing theme files directly, as theme updates overwrite them.
  3. Turn on Auto ads, or create ad units and place them with a block, widget or ad plugin.

Auto ads or manual ad units?

Auto adsManual ad units
SetupOne switch, Google chooses placesYou choose every place
ControlLimited: formats, ad load, excluded pagesFull control over position and size
Best forNew sites and busy ownersSites that want to test layouts
RiskCan place too many ads on some pagesTakes time to set up well

Many sites combine both: Auto ads for anchors and vignettes, manual units inside the content. See how to place AdSense ads and where to place ads on a website.

Don't forget ads.txt

AdSense shows an "Earnings at risk" warning if your ads.txt file is missing. It is one line in a text file at yourdomain.com/ads.txt:

google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0

Replace the zeros with your own publisher ID from AdSense. Many SEO and ad plugins can create the file for you. Check it with our ads.txt checker or build one with the ads.txt generator.

Ads not showing? Check this

  • Site Kit shows "Code has been placed".
  • Your site is listed and approved on the Sites page in AdSense.
  • Auto ads are on, or you have placed ad units.
  • You waited up to an hour after setup.
  • Your ad blocker is off when you test.
  • No caching or optimisation plugin is delaying or removing the AdSense script.

Frequently asked questions

How do I add AdSense to WordPress?

Install the free Site Kit by Google plugin, connect AdSense, let Site Kit place the code and turn on Auto ads in your AdSense account. You can also paste the AdSense code into your site's head section yourself.

Do I need a plugin for AdSense on WordPress?

No, but it is easier. Site Kit by Google places the code for you. Without a plugin, you can add the code to your theme's header settings.

Why are my AdSense ads not showing on WordPress?

Check that the code is placed, your site is approved, Auto ads or ad units are turned on, and no caching or optimisation plugin is blocking the AdSense script. New setups can take up to an hour.

Do I need ads.txt for AdSense on WordPress?

Yes. Without it AdSense shows an earnings at risk warning. Add one line with your publisher ID to an ads.txt file in your site's root.

Sources

Updated December 2, 2026.

Alvils Karlštrems

About the author

Alvils Karlštrems

Alvils Karlštrems is the founder of bannerTag and COO at a header bidding and monetization company. He has worked in programmatic advertising and ad operations since 2017, with hands-on experience in Prebid, Google Ad Manager and publisher ad stacks. Have a question about your ad setup? Connect with Alvils on LinkedIn and send him a message.

View all posts