Deregister count.js of Disqus Comment System plugin in WordPress

I want to deregister the script count.js of the Disqus Comment System plugin in WordPress. The script is in this location:

/wp-content/plugins/disqus-comment-system/media/js/count.js?ver=4.2.2

Read More

I try many different way, but nothing. Like this:

function prefix_my_scripts() {

    wp_deregister_script('count'); /* I tried also 'dsq_count_script' */
}
add_action('wp_enqueue_scripts', 'prefix_my_scripts');

And also:

function prefix_my_scripts() {

    wp_dequeue_script('count'); /* I tried also 'dsq_count_script' */
}
add_action('wp_enqueue_scripts', 'prefix_my_scripts');

I have seen that the plugin generate this script in this way:

    wp_register_script( 'dsq_count_script', plugins_url( '/media/js/count.js', __FILE__ ) );
    wp_localize_script( 'dsq_count_script', 'countVars', $count_vars );
    wp_enqueue_script( 'dsq_count_script', plugins_url( '/media/js/count.js', __FILE__ ) );

After deregister i want to add the script inline before the close of body tag.

How i can do that?

Related posts

1 comment

  1. The script is added by:

    add_action('wp_footer', 'dsq_output_footer_comment_js');
    

    So you should remove it by:

    remove_action( 'wp_footer', 'dsq_output_footer_comment_js' );
    

    You can paste the code in you (child) theme’s functions.php.

Comments are closed.