When i was trying to paste my google tag code into header.php page , the entire page got erased, how can i retrive it.

I am able to the see the sliders in the header area , but the header page is missing in which the display happens. need a immediate solution to retrive it.

1 Answer 1


If it's a prebuilt theme (i.e. you downloaded it from WordPress.org or bought it somewhere), go to the author's website and download a fresh copy. If it's a custom theme, you'll need to rely on your own backups - perhaps you're auto backing up to a Dropbox, or you're using a host that provides file backups.

In either case, if you've only modified header.php, you can FTP in, delete the file, and upload just the header.php from your backup source.

Also in either case, it's never a good idea to use the "edit files" option in wp-admin, or to modify a theme. It's safest to create a child theme and upload it via FTP. That way you're adding new files, not modifying old ones, and as the parent theme gets updated your overrides like GTM will stay in place.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.