Jetpack Speed Tweaks

⏲️ Estimated reading time: 8 min

Table of Contents

Jetpack can add extra JavaScript and CSS, even when you only use a few features. This guide shows how to install a must-use (MU) plugin that forces unused Jetpack modules OFF and can optionally force Photon (Jetpack Image CDN) ON. You’ll also learn what the code does, how to test it, and how to avoid common mistakes.


Jetpack Speed Tweaks (MU): Disable Unused Modules for Faster WordPress. Why Jetpack Can Slow Down Your WordPress Site

Jetpack is powerful because it bundles many features: stats, sharing, likes, related posts, design tools, media tools, and more. The downside is simple: when extra modules stay enabled, Jetpack may load additional scripts, styles, and requests your pages don’t need. That extra weight can affect:


Page load time and Core Web Vitals

Unused features often mean more requests and more work for the browser. That can increase Total Blocking Time and delay LCP, especially on mobile.

Plugin complexity over time

When Jetpack grows into “everything,” it becomes harder to maintain. You forget which modules are on and why.

What This MU-Plugin Does (In Plain English)

This code creates a Must-Use plugin that:

Forces specific Jetpack modules OFF

It hooks into Jetpack’s module system and removes module slugs you list as “disabled.” Even if someone toggles a module ON in Jetpack’s UI, this MU-plugin will still remove it at runtime.

Optionally hides modules from the Jetpack interface

You can hide certain modules so they don’t show up in the UI. This is optional and usually best left empty to avoid confusing yourself later.


Optionally forces Photon (Image CDN) ON

Photon can serve your images via Jetpack’s CDN and can improve delivery speed in many setups. Still, it must be tested with your caching/CDN rules, especially if you also use Cloudflare.

Why an MU-Plugin Is the Smartest Place for This

MU-plugins load automatically from wp-content/mu-plugins/. You don’t “activate” them. WordPress loads them on every request.

That gives you:

Updates won’t overwrite it

Jetpack updates won’t touch files in mu-plugins.

It can’t be disabled by accident

A normal plugin can be turned off by a click. MU-plugins require file access to remove.

It loads early

That helps enforce rules consistently, before regular plugin logic runs.

How the Code Works (Step-by-Step)

The “disabled modules” list

You edit a function that returns an array of module slugs, like: sharing, likes, related-posts.

The main filter: option_jetpack_active_modules

Jetpack stores active modules in an option. This filter lets you modify that list before Jetpack uses it.

The code:

Removes disabled slugs

It filters the active module array and excludes anything in your disable list.

Adds forced ON slugs

It merges in modules you want always enabled (like photon).

Optional UI hiding: jetpack_get_available_modules

This can remove modules from Jetpack’s “available modules” UI list. Good for strict admin control, but risky if you forget you hid them.


Installation Guide (MU-Plugin)

Step 1: Create the mu-plugins folder

Go to:

wp-content/mu-plugins/

If it doesn’t exist, create it.

Step 2: Create the plugin file

Create this file:

wp-content/mu-plugins/jetpack-speed-tweaks.php

Step 3: Paste the code and save

Make sure the file starts with <?php on the first line, with no spaces or hidden characters above it.

Step 4: Test quickly

After saving:

Load your homepage and a post

If you get a critical error, remove the file and re-check formatting.


Full Code to Copy (MU-Plugin)

<?php
/**
 * Plugin Name: Jetpack Speed Tweaks (MU)
 * Description: Forces OFF unused Jetpack modules to reduce overhead; optionally forces Image CDN (Photon) ON.
 * Author: You
 * Version: 1.0.0
 *
 * Install:
 *  - Save this file as: wp-content/mu-plugins/jetpack-speed-tweaks.php
 *  - Create the folder mu-plugins if it doesn't exist.
 *
 * Notes:
 *  - Edit the module lists below to match what YOUR site actually uses.
 *  - This uses Jetpack's official module override filters.
 */

defined('ABSPATH') || exit;

/**
 * Modules to force-disable (keep them visible in Jetpack UI, but toggle is locked off).
 * Use Jetpack module slugs (examples below).
 */
function jpst_disabled_modules(): array {
	return [
		// Examples (ONLY keep what you truly don't use):
		'related-posts',
		'comments',        // Jetpack Comments
		'likes',
		'sharing',
		'carousel',
		'videopress',
		'stats',           // If you don't use Jetpack Stats
		'markdown',
		'shortcodes',
		'widgets',
		'infinite-scroll',
		'search',          // Jetpack Search (only if not used)
	];
}

/**
 * (Optional) Modules to completely remove from the Jetpack UI (hard hide).
 * Usually leave this empty unless you're sure hiding can confuse admins later.
 */
function jpst_removed_from_ui_modules(): array {
	return [
		// Example:
		// 'photon',
	];
}

/**
 * (Optional) Modules to force-enable.
 * Photon = Jetpack Image CDN (good for performance if compatible with your setup).
 */
function jpst_forced_on_modules(): array {
	return [
		'photon',
	];
}

/**
 * Force modules OFF by filtering the stored list of active modules.
 * Jetpack docs: option_jetpack_active_modules filter.
 */
add_filter('option_jetpack_active_modules', function ($modules) {
	if (!is_array($modules)) {
		$modules = [];
	}

	$disabled = jpst_disabled_modules();
	if (!$disabled) {
		return $modules;
	}

	$modules = array_values(array_filter(
		$modules,
		static fn($slug) => !in_array($slug, $disabled, true)
	));

	// Also force-enable selected modules by merging them in.
	$forced_on = jpst_forced_on_modules();
	if ($forced_on) {
		$modules = array_values(array_unique(array_merge($modules, $forced_on)));
	}

	return $modules;
});

/**
 * Optionally remove modules from the available modules list (hides in UI).
 * Jetpack docs: jetpack_get_available_modules filter.
 */
add_filter('jetpack_get_available_modules', function ($modules) {
	if (!is_array($modules)) {
		return $modules;
	}

	foreach (jpst_removed_from_ui_modules() as $slug) {
		if (isset($modules[$slug])) {
			unset($modules[$slug]);
		}
	}

	return $modules;
});

Check Jetpack modules page

Confirm that disabled modules remain OFF.

Best Practices Before You Disable Everything

Jetpack module disabling is safe when you do it with intention. Don’t disable random things “just in case.”

Use this approach:

Disable only what you truly don’t use

Sharing, Likes, Carousel, Infinite Scroll, VideoPress, etc. are common candidates.

Keep important features enabled

If you rely on Stats, Sharing, Related Posts, or Jetpack Search, don’t disable them.

Measure the win

Use Lighthouse / PageSpeed / WebPageTest. Look for fewer requests and less unused JS.


Frequently Asked Questions

What is an MU-plugin in WordPress?

An MU-plugin is a “must-use” plugin that WordPress loads automatically from wp-content/mu-plugins/ without manual activation.

Is this method supported by Jetpack?

Yes. It uses Jetpack’s official module override filters that are documented for customizing module behavior.

What’s the difference between disabling and hiding a module?

Disabling removes it from the active modules list. Hiding removes it from the Jetpack UI so it doesn’t appear as available.

Can I force Photon (Image CDN) ON safely?

Usually yes, but you should test because some setups with strict caching or hotlink protection may block CDN-served images.

Will this break my site?

Only if you disable a module you depend on. That’s why the disable list must match your real usage.

Does this reduce Jetpack’s CSS/JS on every page?

It often reduces overhead, but some assets can still load depending on remaining Jetpack features and your theme.

Can I use this on multisite?

Yes. MU-plugins run for each site in the network, but you must ensure each site’s Jetpack usage is compatible with your disable list.

How do I find the correct module slugs?

The safest way is to check Jetpack’s module list and documentation, then test one change at a time.

What if Jetpack UI shows something ON but it behaves OFF?

UI can be cached or inconsistent. Always verify on the front-end and in your browser’s Network tab.

Can I expand this to disable Jetpack assets per page?

Yes. That’s a separate layer of optimization (conditional loading), but this MU-plugin is the safest first step.

Jetpack Speed Tweaks

Key Takeaways You Should Remember

Jetpack becomes fast when you treat it like a toolbox, not a mandatory bundle.

Use module overrides instead of hacks

This method is stable across updates because it relies on official filters.

Keep your disable list tight

Disable only what you don’t use. That’s where the real performance win lives.


⚠️ Disclaimer and Source Hygiene


This article is for educational purposes and does not replace professional advice. Always test changes on a staging site before production. The approach described is based on documented Jetpack module override behavior and standard WordPress best practices.

🔔 For more tutorials like this, consider subscribing to our blog.
📩 Do you have questions or suggestions? Leave a comment or contact us!
🏷️ Tags: Jetpack speed, WordPress performance, MU-plugin, disable Jetpack modules, Jetpack Photon, Image CDN, WordPress optimization, reduce JS CSS, Core Web Vitals, Jetpack tweaks
📢 Hashtags: #WordPress #Jetpack #Performance #SiteSpeed #CoreWebVitals #MUPlugin #SEO #CDN #Photon #WordPressTips


📚 Sources and References

Jetpack Developer Resources: Module Overrides documentation (official filters).
Jetpack Developer Resources: Photon / Image CDN documentation.
Jetpack Support docs about managing Jetpack features and modules.

Report an issue (max 5 words):

We store the message, post link, time, and IP (for abuse prevention). No account required.

Want to support us? Let friends in on the secret and share your favorite post!

1 online now

Live Referrers

No external referrers recorded for this post.

Photo of author

Flo

Jetpack Speed Tweaks

Published

Update

Welcome to HelpZone.blog, your go-to hub for expert insights, practical tips, and in-depth guides across technology, lifestyle, business, entertainment, and more! Our team of passionate writers and industry experts is dedicated to bringing you the latest trends, how-to tutorials, and valuable advice to enhance your daily life. Whether you're exploring WordPress tricks, gaming insights, travel hacks, or investment strategies, HelpZone is here to empower you with knowledge. Stay informed, stay inspired because learning never stops! 🚀

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.