Code implementation guide
How to insert ad code in your WordPress site
There are several ways to place AdSense ad code into your WordPress site. Below, you'll find information about some of the ways that you can do this.
Connecting your WordPress site
</head>tags. To do this in WordPress, you can either:
- Use a plugin to insert the code. You can use one of the plugins that lets you make changes to the 'header' of your site
- Or, place the code through your WordPress theme settings. We recommend not editing theme files directly.
Be aware that not all themes and plugins allow you to insert code into your site's header. Note that Google is not responsible for malicious third-party themes or plugins.
How to add Auto ads code
Auto ads are a family of ad formats that offer a simple and innovative way for you to monetise your content. To complete the steps to set up Auto ads on a WordPress site, you need to copy and paste the Auto ad code between the
</head> tags of your site. Auto ad code is the same type of code that you added when you connected your site to AdSense. You can use any of the options described in the Connecting your WordPress site section above to add your Auto ad code.
Make sure that you've already created the ad units that you need in your AdSense account.
If you're not familiar with coding, but you'd still like to place your ads in specific placements on your site, you might find it useful to use an ads plugin. You can find plugins in the WordPress Plugin Directory.
An ads plugin can have extra features that help you to place ads without writing or editing code.
When choosing a plugin, here are some things to bear in mind:
Make sure that your theme and plugin are compatible.
All plugins offer different features. We recommend that you test a few plugins to find the best fit for you and your site.
Google is not responsible for the actions of non-Google plugins.
Do you have any questions?
Eanna and Gaetan are AdSense experts and co-authors of this help page. Help them improve this article by leaving feedback below.