Filter Unnecessary Jetpack CSS & JS Files


(Rishi) #1

Hi :grinning:

No doubt Jetpack is one of the best WordPress plugin by Automattic. It provides a lot of interesting features like:-

  • Photon for images
  • Lazy load
  • Social sharing option
  • Spam Protection
  • Brute force attack protection
  • Site stats and analytics

Problem with this plugin is that it activates tons of modules which you never use. This makes WordPress bulky and uglify page speed scores (GTmetrix or Pingdom).

This is tutorial on how to remove or filter unnecessary files of Jetpack WordPress plugin.

#1 Disable Unnecessary Modules

You can use debug option of Jetpack WordPress plugin to remove all unnecessary modules. Go to Jetpack >> Dashboard, then scroll down to bottom and select debug option.


After that, scroll down in next window and select Access the full list of Jetpack modules available on your site. In the next window, disable all unused modules.


#2 Prevent loading devicepx-jetpack.js and jetpack.css

These two files of jetpack are responsible for lowering scores of many sites.


You can filter out them in front end by pasting below code in functions.php of WordPress theme.

// Remove jetpack extra files

function remove_devicepx() {
    wp_dequeue_script( 'devicepx' );

add_action( 'wp_enqueue_scripts', 'remove_devicepx');
add_action( 'admin_enqueue_scripts', 'remove_devicepx' );

add_filter( 'jetpack_implode_frontend_css', '__return_false' );

#3 Remove Query Strings From Static Resources

Images served by WordPress photon always create remove query strings error. But there is no way to remove them (nor suggested) because images are processed in WordPress server.

#4 Remove dashicons.css from front end

Well, this file is not by Jetpack. Instead, dashicons (dashboard font icons) are dashboard icons introduced in WordPress 3.8. If this file is loading in the front end, you can filter it by adding code below in functions.php.

// remove dashicons

function wpdocs_dequeue_dashicon()

	if (current_user_can( 'update_core' )) {


add_action( 'wp_enqueue_scripts', 'wpdocs_dequeue_dashicon' );

Hope you find it helpful.



(I am a magician!) #7

Well, a general question.

Would you still prefer using JetPack?

  • Yes
  • No

0 voters

(Rishi) #8

Yes, because photon module compress and serve images from wordpress cdn . I think this feature is very useful for new sites who can’t afford CDN.

I prefer to disable all modules except security and photon.

(I am a magician!) #9

My favourite is JetPack SSO.