There is a lot of necessities to add code in the header or footer. You might need to integrate with web services to your website and thus you have to add codes. That is not it even when you use different plugins you might need to add custom codes in your header or footer.
If you don’t know how to add code to the WordPress header and footer, then this post is for you. After reading this post you will be able to add code very easily.
Let’s see then.
Adding Header & Footer Code In WordPress
You can add code in WordPress in two ways. Either you can add code using plugins or without using any plugins.
Using A Plugin
To add code in WordPress Header & Footer using a plugin, at first install and activate Insert Headers and Footers plugin. (Read: How to Install A Plugin)
Now navigate to Settings -> Insert Headers and Footers from your Admin dashboard. You will see three different boxes for adding code, header, body, and footer.
Then enter the code in the header, body, or footer field.
Simply put the code in the specific box where you want to add code. For example, if you want to add code in the header, then write your code in the header box. Don’t forget to click the save button once you are done.
Later on, the code will be automatically loaded.
Without Using A Plugin
Plugins always slow you down a bit but save your precious time. If you have experience with coding, then it is wise to add code in the WordPress header & footer without using plugins.
Note: Take a backup of your site before editing theme editor.
At first, navigate to Appearance -> Theme Editor.
Now open header.php or footer.php by clicking on it.
Once the file is opened, you can add code in WordPress Header and footer as you like. You can write your code under the </body> tag.
Once you are done click on the Update file.
I hope now you will be able to add code in WordPress headers and footers by yourself. If you face any problem feel free to share it here, I will be happy to help you. If you liked the post then please share it with your friends and don’t forget to share your thoughts in the comment box below.