How To Add Header And Footer Code In WordPress

Sometimes you’ll need to add custom code to your site’s header or footer – especially when connecting tools like Google Analytics, Facebook Pixel, or verifying your site with services like Bing or Pinterest.

The easiest and safest way to do this is by using the WPCode plugin:

  1. Log into your WordPress dashboard and go to Plugins > Add New.
  2. Search for WPCode – Insert Headers and Footers + Custom Code Snippets.
  3. Click Install, then Activate the plugin.
  4. In the left sidebar, go to Code Snippets > Header & Footer.
  5. Paste your code in the appropriate box:
    • Use the Header box for anything that belongs inside <head>.
    • Use the Body box for code that needs to appear right after <body>.
    • Use the Footer box for code that should go before </body>.
  6. Click Save Changes when you’re done.

That’s it! You’ve added your custom code without touching your theme files.