How To Remove Redirect in WordPress

About the problem – If you click on any links on your site randomly for about 5-6 times, you might get redirected to someplace else like This problem is due to a malicious script installed in your wordpress theme.

This can happen if you are using a pirated version of the theme. Or if someone has hacked into your wordpress site. But don’t worry, it can be solved.

All you need to do is locate the malicious script and remove it.

This script is most likely to be found in header.php of your current active theme.

How to access header.php ?

  1. Login to your WordPress admin dashboard
  2. Click on Appearance.
  3. Click on Editor.
  4. See the right hand side bar. You will find header.php there.
  5. If its not available (that’s a rare case), then you will have to manually access header.php via FTP client.

Now once you open header.php. Copy the code given below –

Then go back to header.php and use CTRL+F to find this code inside header.php. If you find it in the header.php then remove that code from the file and save the file.

This should solve the problem. If you have any questions or if any step is not clear, feel free to comment below. I will reply as soon as possible.

11 Replies to “How To Remove Redirect in WordPress”

  1. I am seeing “redirect..” written on top left on my wordpress theme I don’t know from where it is coming. I have not purchased this theme but when I installed it on localhost on my computer it was working fine. Plz help.

    1. Hello Ranjan, Check the header.php file.
      And find the text “redirect” inside it by using CTRL+F.
      I guess its right after closing tag.
      If that doesn’t work, let me know. I’ll add up more instructions on how to remove it. 🙂

      1. Hi Omkar, thanks for your reply. I have checked header.php file and there is no word “redirect” in it.

        1. Hmm, then use Windows Grep Tool. It helps to search a text inside several files.
          Use that tool to search ‘redirect’ text inside the theme folder. And it will display all files containing the text ‘redirect’. 🙂

  2. Hi Omkar, just wanted to say huge thanks for helping with this malware issue. Your solution worked great and helped me regain control of my hijacked website. !!:)

Comments are closed.