If your website is running on WordPress then you’ve probably been asked to add code snippets to your site’s header. there are lots of web services that request this, including
- Google adsense
- Google Analytics
- Google Search Console
- Online advertising tools
In this article i will share with you guys how you can add code to your wordpress header
What Is a Header?
When they tell you to add a code snippet to your header. What this means is to add the code to your site’s HTML head This section starts with the <head> tag and ends with </head>.
The code between the head tag includes a lot of instructions about your site. It includes the title of your page, your meta description, a link to your CSS and other instructions that help the web browser render your site.
Your site’s content begins after the closing </head> tag.
Inserting Code in the Header Manually
You can insert code snippets in your header yourself if you are technically good.
at your wordpress dashboard, go to Appearance > Editor
You will look for a file named header.php and insert the code snippet in it.
This can also be done by downloading the file via FTP, editing it, and re-uploading it.
Be sure to make this change in a child theme if you use a framework.
Word of warning: whenever you edit code in the Editor, you’re modifying the theme itself. Be sure you have a current backup of your site in case anything goes wrong. If you make a mistake while editing the files manually, you might end up taking your site down.
Inserting Code Using a Plugin
its adviceable to use a plugin than to edit the files yourself.There are a lot of plugins for adding code to your site’s header. Choose one that lets you add HTML to your header.