Disable the plugin’s CSS and JavaScript

Shared Counts loads a stylesheet which contains the styling for the many style options offered by this plugin. You can prevent our stylesheet with the following code:

This code snippet goes in a core functionality plugin or Code Snippets.

add_filter( 'shared_counts_load_css', '__return_false' );
Code language: JavaScript (javascript)

Make sure you include your own styling for the Shared Counts buttons in your theme’s stylesheet.

Disable JavaScript

Shared Counts includes a JavaScript file for the following functionality:

  • Open, close, and submission of the “Share by Email” modal
  • Google Analytics social tracking, allowing you to see when people interact with your sharing buttons
  • Optimize the size of the new windows opened when clicking a share button

You can disable our JavaScript file with the following code:

This code snippet goes in a core functionality plugin or Code Snippets.

add_filter( 'shared_counts_load_js', '__return_false' );
Code language: JavaScript (javascript)

Make sure you account for the lost functionality in your own theme’s JavaScript file. For instance, if you use the Email sharing icon, you will need to manually implement the email sharing modal.

Filters used:

Published by Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributor to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.