Download header.php file into your computer for the backup. You can find this file from your web hosting website, go to cPanel > File Manager > public_html > wp-content > themes > your current theme > choose “header.php” > click download for backup. If you make mistakes on editing header.php, you can re-upload this file and resume the original style of website.
Step (1): Login Google Adsense account and get the Auto Ads code
Find the Auto Ads code from “My ads” > “Auto ads”, select the ad formats you would like to show on the website, and finally click “Automatically get new formats” and “save”. Copy the ad code.
The auto ad code can be inserted in 2 ways, just choose any one of them.
Step (2A): Login your wordpress website and insert the ad code into header.php.
After logging in your wordpress website, go to “Dashboard” > “Appearance” > “Editor”, select the theme file that you would like to edit. Then, find “header.php” under “Theme Header”. Paste the ad code between <head> and </head> and click “update the file” to complete the process.
Tips: If error message appears, re-upload the backup file “header.php” to your web hosting site (i.e. cPanel > File manager > public_html > wp-content > themes > your current theme, replace the old header.php file.
Step (2B): Login your web hosting site and edit the header.php file directly
First, log in your web hosting site and go to cPanel > File Manager (where your web files stored).Second, find header.php from public_html > wp-content > themes > your current theme. Open header.php file with code editor. Paste the ad code between <head> and </head> in header.php file and click “save” to complete the update.
Now, you should able to see the changes of ad formats by adding auto ad code into your website. Just wait for 15 – 20 minutes to see the changes.