disqus / disqus-wordpress-plugin

WordPress plugin for Disqus (Latest version)
https://disqus.com/
34 stars 25 forks source link

jQuery conflict caused by jester.js #71

Closed syedc closed 5 years ago

syedc commented 5 years ago

On WP 5.1, with Disqus 3.0.17, the plugin seems to cause jQuery conflict with custom JS functions.

To Replicate, on a WP Homepage Template, if you have something like the following, it will throw a function not found error for your custom function:

<script>
  jQuery(window).load(function() {
       load_my_stuff();
  });
  function load_my_stuff () {
      console.log('d');
 }
</script>

It seems to come down to a conflict with jester.js, which is loaded on the page with count.js.

A quick fix is to remove count.js...provided you don't need it, by placing the following in your funcitons.php or functions plugin.

function filter_dsq_can_load( $script_name ) {
    // $script_name is either 'count' or 'embed'.
    if ( 'count' === $script_name ) {
        return false;
    }

    return true;
}
add_filter( 'dsq_can_load', 'filter_dsq_can_load' );
Tusko commented 5 years ago

Thank you for help @syedc

tail commented 5 years ago

We have rolled back the change that was causing this issue on the server side yesterday. Please let us know if you are still seeing issues.