How to add header and footer code in WordPress

Do you want to quickly add code to the header or footer tags on your WordPress site without having to worry about your theme files? if yes then this article is for you

Insert Headers and Footers is a free plugin that lets you add insertion code to the headers and footers of your entire website. The code can be easily added and edited right from the WordPress dashboard.

Without plugins like inserting headers and footers, you will have to manually edit the header.php and footer.php theme files whenever you want to add code.

but some themes allow developers to add code to the head and body. u can find it in customize

Using the plugin has many advantages:

  • Faster: No need to find the right theme file and spend time going through the code to figure out where to add your own.
  • Avoid errors: It’s easy to remove the wrong thing or put the code in the wrong place when editing theme files, but a plugin can prevent that.
  • Keep your changes: When updating your theme, you will lose any changes made to the files. By keeping your code separate in a plugin, this will prevent this.
  • Stay Organized: You can see at a glance in your WordPress dashboard the code and scripts you’ve added to your header and footer.

How to insert code in the WordPress header or footer

  1. Start by installing and activating the insert headers and footers plug-in
  2. Go to Settings
  3. Insert headers and footers -> add your code
  4. Any code you want to appear in the header of your site, in the tag, paste it into the first field, Scripts in Header.
  5. Any code you want to insert at the bottom of each page, just before the closing tag, put in the second field, Scripts in Footer.
  6. When you’re done, click Save.

Related posts

Microsoft provides instructions on how to install Windows 11 on unsupported PCs

Azure cloud service causes Microsoft to face an antitrust investigation

OpenAI is about to launch an AI-integrated browser that competes with Google