Skip to content

Instantly share code, notes, and snippets.

@jeherve
Last active May 14, 2016 00:59
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jeherve/df4e349a209d532a7978 to your computer and use it in GitHub Desktop.
Save jeherve/df4e349a209d532a7978 to your computer and use it in GitHub Desktop.
[Jetpack] Remove all CSS.
<?php
// First, make sure Jetpack doesn't concatenate all its CSS
add_filter( 'jetpack_implode_frontend_css', '__return_false' );
// Then, remove each CSS file, one at a time
// You probably won't need them all, unless you use all the modules, and all the themes! :)
// Some of these are also only loaded on specific admin pages, so it wouldn't affect your readers
function jeherve_remove_all_jp_css() {
wp_deregister_style( 'AtD_style' ); // After the Deadline
wp_deregister_style( 'jetpack_likes' ); // Likes
wp_deregister_style( 'jetpack_related-posts' ); // Related Posts
wp_deregister_style( 'jetpack-carousel' ); // Carousel
wp_deregister_style( 'grunion.css' ); // Contact form
wp_deregister_style( 'the-neverending-homepage' ); // Infinite Scroll
wp_deregister_style( 'infinity-twentyten' ); // Infinite Scroll - Twenty Ten
wp_deregister_style( 'infinity-twentyeleven' ); // Infinite Scroll - Twenty Eleven
wp_deregister_style( 'infinity-twentytwelve' ); // Infinite Scroll - Twenty Twelve
wp_deregister_style( 'infinity-twentythirteen' ); // Infinite Scroll - Twenty Thirteen
wp_deregister_style( 'infinity-twentyfourteen' ); // Infinite Scroll - Twenty Fourteen
wp_deregister_style( 'infinity-twentyfifteen' ); // Infinite Scroll - Twenty Fifteen
wp_deregister_style( 'noticons' ); // Notes
wp_deregister_style( 'post-by-email' ); // Post by Email
wp_deregister_style( 'publicize' ); // Publicize
wp_deregister_style( 'sharedaddy' ); // Sharing
wp_deregister_style( 'sharing' ); // Sharing
wp_deregister_style( 'stats_reports_css' ); // Stats
wp_deregister_style( 'jetpack-widgets' ); // Widgets
wp_deregister_style( 'jetpack-slideshow' ); // Slideshows
wp_deregister_style( 'presentations' ); // Presentation shortcode
wp_deregister_style( 'jetpack-subscriptions' ); // Subscriptions
wp_deregister_style( 'tiled-gallery' ); // Tiled Galleries
wp_deregister_style( 'widget-conditions' ); // Widget Visibility
wp_deregister_style( 'jetpack_display_posts_widget' ); // Display Posts Widget
wp_deregister_style( 'gravatar-profile-widget' ); // Gravatar Widget
wp_deregister_style( 'widget-grid-and-list' ); // Top Posts widget
wp_deregister_style( 'jetpack-widgets' ); // Widgets
}
add_action( 'wp_enqueue_scripts', 'jeherve_remove_all_jp_css' );
@pixedelic
Copy link

Is this solution still valid? I'm trying to dequeue both style and scripts for the slideshow, but without success... also tried with TwentyFifteen, but nothing seems to work. TIA

@lonchbox
Copy link

It works but not for all styles, ie:
Related Posts: YES
Sharedaddy: NO

Any idea why?

@bishless
Copy link

bishless commented Jan 4, 2016

For Sharedaddy / Sharing, I'd guess it's because they give users a UI control for including the CSS & JS
Sharing options

I'd love to know how to get rid of the Jetpack Image Widget CSS.
Image Widget css

@bishless
Copy link

Just revisited this issue the other day and came up with this:

wp_deregister_style( 'jetpack_image_widget' ); // Image Widgets
wp_dequeue_style( 'jetpack_image_widget' );

Seems to work on my local install.

@karstenrowe
Copy link

Worked a treat – thank you kindly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment