WordPress is the most popular content management system for a reason. With WordPress, anyone can set up a simple blog or website with a couple clicks of the mouse.

Typically, to get a WordPress website up and running, all you have to do is select a WordPress hosting plan, login to your hosting account, install WordPress, pick a free or paid theme, and follow the intuitive set up instructions.

While these quick set-up steps will help you publish a simple website, what do you do if you want a little extra functionality on your website? For example, what if you want to integrate with web services like Google Analytics and Google Search Console, or what if you want to change the images or add a video to your header?

If you’re a novice website owner, but want more functionality on your website or want to customize your header, don’t worry. It’s possible for even the newest of website owners to edit their website’s header code.

This post will provide instructions on how to edit a header in WordPress.

What is a WordPress header?

The header of your WordPress site is the top element of your website. The header usually contains a logo and your main navigation bar, but it can be customized to include other elements like a search bar, a video, and images. For example, here’s the header for the HostGator blog you’re reading right now:

hostgator blog header

Regardless of what page a visitor clicks on, the header will stay relatively the same. This makes it possible for a website visitor to see your logo, navigation bar, and other custom header elements. 

Behind the scenes, the header is also the place where you can add code—code that is invisible to website visitors—but that provides additional functionality.

For example, by modifying your header code, you can add:

  • Google Analytics tracking code
  • Website verification code
  • Facebook Pixel
  • Google Search Console verification code
  • Pinterest verification code
  • Images
  • Videos 
  • And more!

3 Ways to Edit Your WordPress Header

It sounds tricky to edit your header. The truth is, depending on what you’re trying to do, it can be tricky to edit your header. However, WordPress provides different methods to edit your header that make it easier for novices. 

Let’s talk about the different ways you can edit your WordPress header.

1. Edit your WordPress theme’s header.php files

The first way to edit your header is to edit your theme’s header.php files. I briefly mention this because it is certainly a viable way to edit your website’s header. Changing the theme’s header.php file will save you from adding a plugin to your website, but it’s not the easiest method, especially for newbies.

To edit your theme’s header.php files, you have to have some basic coding skills. If you don’t have basic coding skills, or don’t want to mess around with your theme’s header.php files, skip to the next method.

If you’re adventurous, here are some basic instructions on how to edit the header by altering the code.

  1. Login to the admin section of your WordPress site.
  2. Turn your attention to the left navigation bar, hover your cursor over “Appearance,” and click on “Theme Editor.”
  3. Once you click on “Theme Editor,” WordPress will show you the current theme’s style.css file which you can edit.
  4. On the right side of the screen, you’ll see your theme’s files.
  5. Scroll down until you see “Theme Header,” or the header.php, and click on this file to open it in your editor.
  6. Add your respective custom code to the file between the <head> and </head> tags.
  7. Click on “Update File” to save your edits.

If you follow these steps, you should be able to edit your WordPress header and add tracking codes.

Keep in mind, if you take this route, then every time you update your theme, you’ll have to edit your theme’s header.php files again. 

Now, let’s talk about an easier way to edit your header in WordPress.

2.  Edit the header by installing the Insert Headers and Footers plugin

As a quick review, WordPress is an open-source platform. This means other WordPress users and developers can code apps, called plugins, that will help a website perform a specific function.

In other words, plugins make it so that instead of needing to add code to your WordPress website, all you have to do is install and activate a plugin, and the plugin will do all the hard coding work for you.

There are nearly 50,000 different WordPress plugins, making it possible for website owners to add a plugin to customize a website. One of these plugins is the Insert Headers and Footers plugin. This plugin makes it possible to customize your headers (and footers) without having to alter the theme’s header.php or footer.php files.

Here are the steps for editing your header using this method:

  1. Login to your WordPress admin page.
  2. Turn your attention to the left navigation bar, hover your cursor over “Plugins,” and click on “Add New.”
  3. Once you are on the Plugins page, search for “Insert headers and Footers.”
  4. Click “Install” and then “Activate.”
  5. Once you have activated the plugin, go to your admin panel, hover your cursor over “Settings” and click on “Insert Headers and Footers.”
  6. From here, the settings may have a few boxes, including “Scripts in Header,” “Scripts in Body,” and “Scripts in Footer.”
  7. Paste the code in the “Scripts in Header” box.
  8. Press save.
wordpress headers and footers plugin

The advantages to using a plugin are numerous. First, the plugin makes it easy for you to edit your WordPress header without having to code. The plugin also keeps all your edits in one convenient location, and you can edit it any time you want.

Opting for the plugin also prevents you from altering your code in the wrong place, potentially saving you from messing up your website. 

Finally, when you change your header using a plugin, the plugin will save your information. Every time you update your theme, the plugin will update your header information, so you don’t have to edit your header again.

3. Use your WordPress theme’s built-in editing feature

Another way to edit your website’s header is to use your theme’s built-in feature. I mention this as the third option because it’s only a viable plan if your theme offers this feature.

Some WordPress themes have this option but others do not. If you do have a theme that allows you to add code and scripts to your WordPress header and footer via this method, then you won’t have to install and the Insert Headers and Footers plugin.

Just keep in mind that if you switch your theme to one that doesn’t offer this enhanced feature, WordPress will not save your code.

How to add images to your WordPress header

If you want to add an image to your header, then it’s a simple process. All you have to do is follow a few easy steps. 

Here’s what to do:

  1. Login to your WordPress admin dashboard.
  2. Turn your attention to the top navigation bar and click on “Customize” in the left hand corner.
  3. WordPress will open a new menu on the left hand side of your dashboard.
  4. Click on “Header Image.”
  5. Upload an image.
  6. Click on “Add new image.”
  7. Click on the “Publish” button at the top of the page.

It can be tricky to get the image right the first time. The good news is WordPress will usually inform you of what image size works best with your theme. 

For example, when I navigate to this part of my website, WordPress shows me the following bit of information:

Click “Add new image” to upload an image file from your computer. Your theme works best with an image with a header size of 380 × 90 pixels — you’ll be able to crop your image once you upload it for a perfect fit.

When you have completed these steps, you’ll see your new header image on every page of your website.

Alternatively, you can edit your header image by turning your attention to the navigation bar on the left side of the screen, hovering your cursor over “Appearance,” and then clicking on “Header.” This will get you to the same place.

Ready to Edit Your WordPress Header?

Editing your header is a great way to customize your website to make it unique. Adding code to the header is also the primary way many tracking integrations work with WordPress.

To edit your header, you can either learn how to edit the header.php file or simply install, activate, and customize the settings of the Insert Headers and Footers plugin.

Remember, WordPress is one of the most intuitive content management systems on the market. To get started with your WordPress site, head over to HostGator website and check out our affordable WordPress hosting plans today.

Ashley R. Cummings is a professional freelance writer specializing in SaaS, tech, and advertising/marketing. In a previous life, she was a Russian teacher at Brigham Young University, a corporate trainer, and a grad student—all at the same time. When she’s not writing, you can find her traveling the world with her 2 kids and husband, reading poetry or taking a deep dive into the fabulous world of comedy. Connect with her on Twitter at @ashleyrcummings.