close
The Wayback Machine - https://web.archive.org/web/20230718155900/https://wordpress.com/support/adding-code-to-headers/
Back to Support Plugins and Integrations Add Code to Headers

Add Code to Headers

Some services, such as Google Adsense and Mailchimp, ask you to add code to the site header in order to verify the site, add content, integrate features, or more. This guide will show you how.

Integrated Services

For Google, Bing, Pinterest, Yandex, and Facebook Business, we have a more straightforward way to verify your site or domain, explained on Site Verification Services. This method allows you to safely add the code without manipulating site files.

Visit Tools → Marketing → Traffic and scroll down to Site verification services to access these tools.

Adding Code to Headers.php

This section of the guide applies to sites with the WordPress.com Business or Commerce plan. If your site has one of our legacy plans, this feature is available on the Pro plan.

If you’re trying to add code to the header of your site, the instructions may vary, but it can usually be done the same way here at WordPress.com. Some places will explain that it should be added between <head> and </head> while some will suggest using a theme editor or adding to the HTML header.

The reason these codes are added to the header is so that the code shows on every page and post of your site.

We recommend using a plugin to do this, such as the WPCode – Insert Headers, Footers, and Code Snippets plugin.

  1. Install and activate the free WPCode – Insert Headers, Footers, and Code Snippets plugin.
  2. In the dark bar on the left-hand side of your dashboard, click Code SnippetsHeader & Footer.
  3. Paste the code into the Header box and click Save Changes.
The WPCode - Insert Headers, Footers, and Code Snippets plugin has a few sections, but the top is for adding code to the header. At the bottom it notes "These scripts will be printed in the head section".
Paste the code into your site header and save your changes

Common Services

Some popular services that require adding code to the site header include:

Was this guide helpful for you?

Not quite what you're looking for? Get Help!

Copied to clipboard!