For example, Google Analytics installation code needs to be present on every page of your website, so it can track your website visitors.
You can add such code to your WordPress theme’s header.php or footer.php files. However, these changes will be overwritten when you update or change your theme.
First, you need to install and activate the Insert Headers and Footers plugin. For more details, see our step by step guide on how to install a WordPress plugin.
Upon activation, you need to visit Settings » Insert Headers and Footers page. You will see two boxes, one for the header and the other for the footer section.
Insert Headers and Footers plugin will now automatically load the code you added on every page of your website.
This method requires you to add code to your WordPress files. If you haven’t done this before, then please see our guide on how to copy and paste code in WordPress.
First, let’s take a look at how to add code to your WordPress site’s header. You will need to add the following code to your theme’s functions.php file or a site-specific plugin.
Instead of is_single, we are now using is_page to check for page ID.
First, you need to install and activate the Code Embed plugin. For more details, see our step by step guide on how to install a WordPress plugin.
Now scroll down and below the post editor, you will see the ‘Custom Fields’ metabox where you need to click on the ‘Enter new’ link.
The custom field name and value fields will now appear.
Don’t forget to click on the ‘Add Custom Field’ button to save your custom field.