How to add custom code in header / footer in WordPress

In WordPress there are needs like add google tracking code/google ads code/etc. in header. There are needs to quickly add cdn link/javascript/jquery code in header/footer to fix and handle things. We may also need to add CSS code in header of website. It is requirements for many website owners to track their websites as demanded by various google and other online services. Experts need it to add new functionalities and fix issues which otherwise don’t work in WordPress because of limited access in WordPress.

Various methods to add custom code:

1) Go to Appearance > Theme editor and search file named header.php/footer.php, however many themes have kept these files complex and adding custom code may not work directly in header or footer file.

2) Download File manager app, go to Cpanel file manager or use FTP and search files of WordPress. You may want to create new file for javascript and link it to your website through functions.php file. These methods sometimes fail to work because of complexity and other restrictions of WordPress.

Above methods need time and coding skills. Sometimes there are server or cache issues which don’t allow the editing in website to display on live website and some times there are theme coding standards/restriction which may not easily allow you to code in theme files for the requirement. There is also high risk for an owner to mess up file structure and other code in WordPress files which can make website to stop work. In case the above methods fail for you or you don’t want to waste so much time, etc., try the DIY quick method given below:

3) Use a ready-made WordPress app to add code directly in header/body/footer of WordPress website. There is a ready-made plugin available to do it quickly with proper instructions mentioned: