• Resolved nigeltp

    (@nigeltp)


    Hi folks,

    I’m currently going nuts trying to find a script I want to remove from my WordPress installation. I’ve tried hunting through the WP files in Filezilla and also the files Editor, but with no luck.

    Is there an easy way to do a search of all the WP files for my site to locate the little beggar?

    Thanks.

Viewing 11 replies - 1 through 11 (of 11 total)
  • If you have shell access to the server:

    find . -name 'your-script.ext'

    Thread Starter nigeltp

    (@nigeltp)

    Thanks very much for the suggestion, but unfortunately that’s a geek step too far for my pathetic talents. Not sure I have shell access either. Is there a slightly more ‘conventional’ method I could try?

    Everything is easier and quicker through the shell, it’s these pesky GUI thingamabobs that slow everything down. 😉

    What’s the nature of the file. You say it’s a script, what’s the extension and what does it do?

    Thread Starter nigeltp

    (@nigeltp)

    Heh, yes I know, that’s why we muppets rely on experts like you. 🙂

    The script is for sitemeter.com (the hits counter). It’s a legacy bit of code which I’ve had on the site for years and now they’ve decided to serve pop up spam videos without asking permission. Nasty. I want them gone.

    Here’s the code – http://i.imgur.com/ZISbANY.jpg

    Hi

    If you’ve downloaded the files with ftp then you could use a text editor like notepad++ to do a search on a bit of the script in all the files of the theme folder on you desktop.

    Kevin

    Thread Starter nigeltp

    (@nigeltp)

    Thanks Kevin, I’ve thought of that, but there are *a lot* of files. I already did a search of the main ones I could think of (e.g. header, footer, functions etc) using the Filezilla download and that turned up nothing. Like I said, I’m going nuts with this one.

    You could try the folder search abilities if you use Notepad++

    when you open the programme select Search then Find in Files
    then add a bit of the code you are trying find and then select the folder on your desk top.

    make sure you have search all sub folders ticked and the click find all

    Notepad++ will then return all the files that contains the code.

    I would probably do a search on just the first html comment line. At it assumes that the code is not base64 encoded.

    Kevin

    Thread Starter nigeltp

    (@nigeltp)

    Brilliant suggestion Kevin, thanks very much. I have downloaded and checked wp-admin, wp-includes amd all the major parts of wp-content and found one instance which I removed. But the main page code is nowhere to be found, so it’s still there on the site somewhere. It’s absolutely crazy.

    Hi

    I would not worry about searching the WordPress folders. This will be in your theme folder – or possibly the parent theme folder if you are using a child theme – you should not find it in any of the core WordPress files.

    Did the counter come with the theme when you installed it? If so and you can not find the code then it is probably base64 encoded which a lot of ‘free’ themes do to try and prevent an easy job of removing the sponsorship scripts.

    You’ll need to do a search for base64 encoded code then decode it and make changes.

    Kevin

    Can you replicate the problem using the default Twenty Fourteen theme with all plugins deactivated?

    Thread Starter nigeltp

    (@nigeltp)

    Thanks everyone, found it. Well actually someone else did for me after I spent a day searching. It was embedded in the theme customizations in the dashboard for some weird reason. But many thanks for all the great help, and Kevin that Notepad++ tool is a keeper for me now. 🙂

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘How to locate a script in the WP files easily?’ is closed to new replies.