How to Edit Header in WordPress (3 Best Methods)

In this post, we show how to edit header in WordPress using 3 different methods. You can use the theme editor, cPanel, or a theme’s customization option.

WordPress is the most popular CMS in the world. Using this amazing software, you can create your own website within a few minutes. WordPress is also open-source. You can make your own customizations on your copy of WordPress. You can also edit the header in WordPress using various methods.

WordPress offers a lot of flexibility which is one of the best features of this platform. All you need to do to build your WordPress website is choose a domain and hosting plan and then install WordPress. Then you simply need to install a theme and a few plugins and you are good to go!

Although installing WordPress and setting up the themes and plugins is really easy, almost every WordPress website needs a little tweaking to be perfect. For example, you may want to integrate web services like Google Analytics, Google Search Console, etc. For these tasks, you need to edit your theme header file.

Again, on the front-end, the header portion of your site contains the logo, top navigation bar, etc. You may also want to edit the header to customize the top front-end portion of the website.

WordPress gives you the freedom to customize and make changes to your theme files. You can edit your WordPress header by manually making changes to the header.php file or you can use a plugin to do it. WordPress itself also has some header tweaking options. Most of the modern themes come with a lot of header customization features. In this post, we are going to learn how to edit header in WordPress. So let’s get started.

What is the WordPress website header

The header is the topmost element on your website. It usually consists of a logo and a menu that consists of navigation links. It can be customized to add other elements such as the search bar (or icon), buttons, images, etc.

Get Latest Post Notifications!

Subscribe to our newsletter

Every website has a header. If you look at the HTML tags, then the header is referred to as the <head> tag. This is the place where generally all the links, meta, and tags are included. When changing a header, there are 2 types of changes that are generally considered:

  1. Invisible elements such as the meta and script tags
  2. Visible elements such as the logo and navbar

The invisible elements in the header are not visible to the visitors of the website but those are responsible for the site’s proper functions. Some of these invisible elements include

  • Stylesheet links
  • Script file links
  • Links to fonts
  • Meta tags etc.

While there are many invisible elements, there are also elements that the visitors see. These are:

  • The logo
  • The navigation menu items
  • Header image
  • Search bar
  • Buttons, etc.

When you customize your site header, you can change the invisible and visible elements. 

Why would you edit header in WordPress?

Now that you know what a WordPress website header really is, the question comes to mind, why would you edit the header in WordPress. Well, there are a couple of reasons. First of all, if you want to change your website logo or want to change the navigation menu items, you have to edit the header. The WordPress theme you use usually gives you all the options to do these tasks.

You can also edit the header file using a plugin or manually make changes to your header.php file. But generally, when you use a plugin or make manual changes to your header file, you’re probably looking to integrate various web applications. 

To add services like Google Analytics, Google Search Console, Google Ads, etc. you need to integrate Google Tag Manager (GTM). Then you can simply add the tracking and marketing services like Google Analytics, Google Ads, etc.

There are various Google web applications that websites generally use. After integrating Google Tag Manager, you can use Google Analytics Tracking code to gather data on your website traffic. To do that, you need to edit header in WordPress.

Also, the header needs to be edited for connecting Facebook Pixel. Facebook Pixel is a marketing tool that tracks your traffic to see how effectively they turn clicks into sales. Simply put, Facebook Pixel is an application like Google Ads but for Facebook ads. To connect to Facebook Pixel you have to edit the header in WordPress.

3 ways to edit your WordPress header

There are a few ways in which you can edit your WordPress header. Depending on what you are planning to do, this might be a little bit tricky. But as we’ve mentioned earlier, WordPress gives you the freedom to customize your website the way you want. Keeping that in mind, let’s learn how to edit header in WordPress.

Using a plugin to edit your WordPress header

If you’re looking to insert a code, the easiest method is using a plugin to edit your WordPress header. (Unless the theme offers a way to do so). There are various plugins such as Insert Headers and Footers, Header and Footer scripts, etc. You can use any of these plugins to edit your WordPress website header in this case.
For this demonstration, we are going to use the Insert Headers and Footers plugin. So from your WordPress dashboard, go to Plugins > Add New and then look for the “Insert Headers and Footers plugin”.

insert headers and footers by WPBeginner

After you install and activate the plugin, you can access it from Settings > Insert Headers and Footers. The interface is as simple as it can be. The top input section is the header. This is where you can insert your scripts and tags. The region below the header is the body section. You can put other tags and contents here.

insert headers and footers plugin

Using this method you can edit your WordPress header and connect web services like Google Analytics, Google Ads, Facebook Pixel, etc. And that is how to edit header in WordPress using plugins.

Editing the header.php file of a WordPress theme

Now that you know how to change header in WordPress using a plugin, let’s learn how to edit header in WordPress using the theme editor. When creating a website on WordPress, you need a theme. Every theme has a header.php file that you can edit. 

However, this approach of editing your header requires you to make changes to your theme files. If in some way the editing goes wrong, it can mess up your entire website. So before editing your theme files make sure to backup your WordPress website just to be on the safe side.

To access your website header.php file, there are 2 ways:

  • From your WordPress dashboard
  • By accessing website files from cPanel or FTP

You can choose any method you wish but editing the header.php from your WordPress dashboard is easier than doing it with FTP or cPanel. We will show you both processes.

Editing header.php from WordPress dashboard

To access some of your theme files from the WordPress dashboard, go to Appearance > Theme File Editor (for some themes the theme file editor might be located in Tools > Theme File Editor). This will open up the theme files but if this is your first time accessing your themes core files, WordPress will give you a “Heads up”.

WordPress Theme File Editor heads up message

Basically, this message will inform you of the dangers of editing the core files of a theme. It will also advise you to make a child theme and take necessary safety measures. Consider it carefully. Then click on the “I understand” button to close this message. 

How to Edit Header in WordPress

Then find a file called header.php or Theme header from the menu on the right side and click on it. It will open up the file in the editor. Now you can insert your code between the header tag <head> </head> and click on “Update File” to save your changes.

Note: In this example, we have used the popular Astra theme. The location of the header.php or Theme Header file might be different for different themes. 

Editing header.php from the File Manager in cPanel

You can also edit your header.php file through File Manager in cPanel or by using an FTP client software like FileZilla. Using this method you will be able to access your core WordPress files. For the cPanel method, the first thing that you need to do is access your cPanel. If you don’t know your cPanel credentials you can ask your hosting provider.

cPanel login

After you log in to your cPanel find the Files section and click on the File Manager.

File Manager in cPanel

Once you open up the File Manager, locate the folder that contains your WordPress website files. Generally, the public_html folder contains all your website files.

public_html folder in File Manager

Inside you will find several files and folders. To edit your Header in WordPress, go to wp-content/themes/Astra (name of your theme)/ header.php. Just double-click on the file and it will open the file in an editor. From there you can edit the header and once you are done, make sure to save your changes. And now you know how to change header in wordpress.

Alternatively, if you want to access your files via FTP/SFTP, you need to use client software such as FileZilla. Then you have to setup an FTP account. You can take the help of your domain and hosting provider to do that. Then using that credentials connect your website with your FTP/SFTP client. You can then find the same public_html folder and edit your WordPress header.

Using your theme’s built-in header editor

If you want to simply customize the visible elements on your header then you can try out this method. Every theme comes with its own customization options. This is one of the best advantages of using themes on WordPress. From your WordPress dashboard go to Appearance > Customization, it will open up a customization menu. From here you can do a lot of things for your header, such as:

  • Customize your website logo
  • Add a menu to your header
  • Add buttons, search
  • Customize the overall site identity

Every theme has their own unique way of customization. Some premium themes even give you header builders to build your header. You can drag and drop the elements to build your header live.

How to Edit Header in WordPress - Astra header builder

However, this method may not allow you to insert tags and customize the core files of the themes. So if you want to add Google Tag Manager, Google Ads, Facebook Pixel, etc. you might not be able to do it from here. But there are some themes that allow you to put your custom code on the header file. If your theme allows this option, then you don’t have to use any plugin to edit the header in WordPress.

But do remember, you’re editing the header for a theme, if you switch your theme, your custom code will not be saved for the other theme. So you’ll have to edit the header file for that new theme again.

👉 Video: How to Edit WordPress Header and Footer

Conclusion

Creating a website on WordPress is a breeze! You pick a theme and if you have a demo importer, it’s even easier. But sometimes you need to make certain changes to your website in order to truly personalize it. It is also a great way to make your website unique and a primary method of adding a tracking integration system to your website.

We have shown you 3 different methods to edit the header in WordPress. Depending on why you want to edit your header in WordPress, you can choose any of the methods that we discussed.

We hope that this article was helpful and you now know how to edit header in WordPress. Let us know in the comment section which process you use to edit your header.


Disclaimer: This post may contain affiliate links and we may receive a small commission if you purchase something by following them. However, we recommend services/products that we believe good to serve your purpose.

Staff Author

Staff Author

A team of WordPress enthusiasts led by Arafat Bin Sultan, a seasoned professional with over a decade of experience in tech blogging, content marketing, and video creation.

Articles: 252

Leave a Reply

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

Discover more from WPGIZ

Subscribe now to keep reading and get access to the full archive.

Continue reading