52

I inserted the following code in a WordPress plugin:

   wp_deregister_script('jquery');
   wp_register_script('jquery', "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js");
   wp_enqueue_script('jquery');

The following is echoed to the browser:

<script type='text/rocketscript' data-rocketsrc='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js?ver=3.3.1'></script>

Instead of:

<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'></script>

I don't know what is happening. Perhaps wp_register_script() is supposed to work in this way. I also tested if any jQuery code worked on the client side but it didn't.

Maxime
  • 8,645
  • 5
  • 50
  • 53
Tabrez Ahmed
  • 2,830
  • 6
  • 31
  • 48

4 Answers4

53

It is easy to fix.

You must change the following tag: <script type="text/javascript"></script>

add: data-cfasync="false"

example:

<script data-cfasync="false" type="text/javascript"></script>
thirtydot
  • 224,678
  • 48
  • 389
  • 349
Frank
  • 539
  • 1
  • 4
  • 3
15

Probably one of wordpress plugins is using CloudFlare.

https://support.cloudflare.com/hc/en-us/articles/200168056-What-does-Rocket-Loader-do-

Try disabling all the plugins and re-enabling them one by one to find out which one is causing this issue. It's not a problem actually.

matt3o
  • 615
  • 1
  • 5
  • 17
Emir Akaydın
  • 5,708
  • 1
  • 29
  • 57
  • 1
    Yes, rocketscript is Cloudflare's technology. – Emir Akaydın Mar 13 '12 at 09:16
  • 1
    As far as i know CloudFlare is not coming with wordpress by default. You should be able to disable RocketScript somehow (probably by disabling a plugin or from a config page). Maybe you should try things like CTRL+F5 or clearing the browser cache. But i can assure you don't have that issue with a clean wordpress installation. – Emir Akaydın Mar 13 '12 at 09:29
4

Rocket Loader is not included in any WordPress plugins. You would have to disable Rocket Loader by going to: settings->CloudFlare settings (Performance Settings)->Rocket Loader->Toggle Off (this feature is optional and has to be turned on).

1

I was facing this issue with

WP Rocket plugin which was adding type='text/rocketscript' to the script tags.

Fixed it by adding

data-cfasync="false"

to the script tags.

parik
  • 2,313
  • 12
  • 39
  • 67