Why is WordPress placing “text/rocketscript” instead of “text/javascript” when using wp_register_script()?

前端 未结 4 682
栀梦
栀梦 2020-12-01 04:15

I inserted the following code in a WordPress plugin:

   wp_deregister_script(\'jquery\');
   wp_register_script(\'jquery\', \"http://ajax.go         


        
相关标签:
4条回答
  • 2020-12-01 04:39

    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).

    0 讨论(0)
  • 2020-12-01 04:40

    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.

    0 讨论(0)
  • 2020-12-01 04:42

    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>
    
    0 讨论(0)
  • 2020-12-01 04:56

    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.

    0 讨论(0)
提交回复
热议问题