How to Add Code to Your Site Header on a Specific Page in WordPress

January 25, 2018

This post may contain affiliate links, which means I will receive compensation if you click through and make a purchase.

How to Add Code to Your Site Header on a Specific Page in WordPress

You’ve just been given a code to add to the header of a specific page in WordPress. Now what? Before you stress yourself out wondering how you’re going to be able to add the code, take a deep breath. It’s actually a lot easier than you think. I’ve got the step-by-step instructions on how to add code to your site header on a specific page.

Watch the video tutorial or keep reading to find out more.

How to add code to your site header on a specific page

1. Install and activate the Header and Footer Scripts plugin

2. Edit the page or post that you want to add the code to.

3. In the insert script to head box, copy and paste your code.

4. Save your page/post.

The code has now been successfully added!

To add code to the header or footer of your site on a sitewide basis, you can use the same plugin. Just to to Settings > Header and Footer Scripts and paste your code into the appropriate box. This will add the code to every page on your site.

For an alternate method to add code to the header or footer sitewide, visit How to Insert Code into the Head Section of Your WordPress Blog.

Need some development help?

24 thoughts on “How to Add Code to Your Site Header on a Specific Page in WordPress”

  1. Hey, thanks so much for this. I have a question – if I have two scripts /codes to be added on the website, but one code is for the whole site of 10 pages, except for one page. And the second code is for one page only (out of the 10 pages). So do I need to add the first code to every page of the site, i.e., 9 pages? Or is there a way to just add the code once for the 9 pages? And then I can add the second code on the 10th page too.

  2. Nice post but unfortunately, the plugin is no longer maintained.

    Also, is there a plugin that allows me to place code in the header of all my blog posts excluding pages?


  3. Great article here , Good article.
    Great article, just what I needed.
    Hello to all, the contents existing at this site are in fact awesome for people experience, well, keep up the good work fellows.

  4. Hi,

    I followed the steps and it does work but now the snippet is showing where the header is. How can I hide the snippet so visitors can’t see it?

    Thank you.

  5. I love the simple plugin you have to add to header of specific pages specially to track conversions. But I feel hesitant to install it because the plugin hasn’t been updated for 11 months?

  6. Hi,

    I’m not sure exactly why but this web site is loading extremely slow for me. Is anyone else having this problem or is it a issue on my end I’ll check back later and see if the problem still exists.


Leave a Comment

Your email address will not be published. Required fields are marked *