0

In my WordPress website, I am using the Cloudflare and Elementor editor also but when I am trying to edit the page using the Elementor, my Elementor is not opening. I think it is because of the Cloudflare in my WordPress.

Cloudflare has added the script in the head and also in the footer:

<script src="https://ajax.cloudflare.com/cdn-cgi/scripts/95c75768/cloudflare-static/rocket-loader.min.js" data-cf-settings="9838dd25b616f37c8176faa3-|49"></script>

So, How to exclude the script from WordPress?

Added this in my functions.php

add_filter( 'script_loader_tag', function ( $tag, $handle ) {

if ( 'script-handle' !== $handle )
    return $tag;

return str_replace( "type='text/javascript' src", ' data-cfasync="false" src', $tag     );
}, 10, 2 );

But not working.

Also tried this by adding in the functions.php:

<script data-cfasync=”false” src=”/javascript.js”></script>

But not working.

Any help is much appreciated.

2 Answers 2

1

This helps me to solve the problem:

https://snifflevalve.com/elementor-tutorials/elementor-cloudflares-rocket-loader-not-play-well-together/

0

Why you are using a filter? wp_enqueue_script() function would be much better. Anyways, Rocket Loader seems to be conflicting with some WP component, i.e Jetpack. Hope can help

4
  • 1
    Hi SHax, I want to dequeue the rocket loader script because it is creating a problem with the elementor editor. So, can you help me with that? Oct 29, 2019 at 16:39
  • This is well explained here, please check: wordpress.stackexchange.com/questions/189985/…
    – Capolooper
    Oct 30, 2019 at 17:10
  • I think this is a script that Cloudflare is adding as it caches the site. I don't think it's a script you can dequeue from inside WordPress, because it's not added there.
    – Rup
    Oct 31, 2019 at 13:34
  • if so, unique opportunity is 1) disable CF 2) change theme
    – Capolooper
    Nov 1, 2019 at 14:04

Not the answer you're looking for? Browse other questions tagged or ask your own question.