Sticky sidebar not working after you turned on a cache plugin

Last updated: 4 November 2026

Your sticky widget worked until you switched on WP Rocket, LiteSpeed Cache, Perfmatters or another speed plugin, and now it scrolls away with the page, or sticks only after you move the mouse. That is almost always the optimizer holding back the sticky plugin's JavaScript. This page explains the three ways it happens, how to recognise each one, and the exclusions that fix it for the most common sticky plugins.

We make a sticky widget plugin, Quicksloth Sticky Widget, so we are not neutral. We are not affiliated with any of the plugins or services named here. On 4 November 2026 we tested LiteSpeed Cache 7.9.3 and Autoptimize 3.1.17 on a test site with WordPress 7.1.4 and Twenty Twenty-Five, in Chromium 153 and Firefox 155, with our plugin (version 1.0.2) and with Fixed Widget 6.2.3. WP Rocket, Perfmatters, W3 Total Cache, SiteGround Speed Optimizer and Cloudflare Rocket Loader are not tested by us: what we say about them comes from their official documentation or from their plugin's code, with the date we read it. If your sticky sidebar was never working, the causes are in CSS instead: see six reasons a sticky sidebar does not work.

Short version

Why a cache plugin stops a sticky sidebar

A sticky widget plugin is a script: it finds the marked widgets, measures the page and keeps them in view as you scroll. Speed plugins change when and how scripts run, in three ways that matter here.

  1. Scripts wait for an interaction. WP Rocket describes its option as "delaying the loading of all JavaScript files and inline scripts until there is a user interaction" (WP Rocket, last updated 11 March 2026). LiteSpeed Cache's Delayed and Perfmatters' Delay all scripts do the same. Until the visitor moves the mouse over the page, uses the wheel, a key or a touch, the sticky script has not run, and the widget scrolls away like any other box. In our test with LiteSpeed Cache's Delayed, the widget was 2,429 px above the window when we scrolled a third of the way down without touching the page, and stuck at the right place after one turn of the mouse wheel.
  2. The script and its settings are split up. Most sticky plugins print their settings in a small inline script right before their file (in WordPress, with wp_add_inline_script() or wp_localize_script()). If you exclude only the file, the file runs at once and the settings arrive later with the delayed scripts. Depending on the plugin it then uses its defaults or fails. Plugins that depend on jQuery can fail the same way when jQuery is delayed or loaded after them.
  3. The page cache serves an old copy. If you mark a new widget as sticky, or change a margin, visitors keep getting the cached page from before the change until the cache is cleared or expires.

These problems are common. In the titles of the last 1,201 threads of the support forum of Fixed Widget (read on 4 November 2026), at least 16 name a cache or optimization plugin: WP Rocket, Autoptimize, W3 Total Cache, Hummingbird, Fast Velocity Minify, WP Super Cache, Cloudflare's Rocket Loader and "jquery in defer mode". Outside that forum, one WordPress.org thread reports a sticky bar that stopped with WP Rocket and came back with the delay turned off.

How to tell which one it is

  1. Open a long post in a private window, so you see the page as a logged-out visitor does: some optimizers treat logged-in users differently.
  2. Keep the pointer still, outside the page, while it loads, then watch the widget. If it is not sticky and snaps into place only when you move the mouse over the page, turn the wheel or press a key, it is cause 1: a delay.
  3. Check in DevTools: right-click the page, choose Inspect, and search the Elements panel (Ctrl+F, or Cmd+F on a Mac) for the sticky plugin's file name. A delayed script has its type changed: type="rocketlazyloadscript" with WP Rocket, type="litespeed/javascript" with LiteSpeed Cache. With LiteSpeed's JS Combine on, the file is gone from the page and its code is inside a combined file in /wp-content/litespeed/js/.
  4. If the widget sticks without any interaction but at the wrong distance from the top, or ignores your other settings, it is cause 2: the file runs and its settings do not.
  5. If you changed a widget or a setting recently and visitors still see the old behavior, it is cause 3: clear the cache. Adding a query string such as ?test=1 to the address often gets an uncached copy to compare with.

A delay can look random across browsers. In our earlier tests with LiteSpeed Cache, Chromium started delayed scripts by itself when the pointer was over the page as it loaded, because it sends a mouseover event there; Firefox and Safari's engine did not. A sticky widget that "works in Chrome only" after you turned on an optimizer is a strong hint of cause 1.

The exclusions for each sticky plugin

The optimizers compare each line you enter with the address of a script file, and with the text of an inline script. So a good exclusion is a word that appears in the plugin's file path and, if needed, a word that appears only in its inline settings.

Sticky pluginLines to exclude from delayScript handle (for lists by handle)Tested by us
Quicksloth Sticky Widgetquicksloth-sticky-widget
qsswConfig
qssw-stickyYes, LiteSpeed Cache 7.9.3
Fixed Widget (q2w3) 6.2.3q2w3q2w3_fixed_widgetYes, LiteSpeed Cache 7.9.3
Astra or Kadence sticky sidebar optionUsually nothing-No

LiteSpeed Cache

The labels below are copied from the code of LiteSpeed Cache 7.9.3, released on 3 November 2026.

What we saw with CSS Minify, CSS Combine, JS Minify, JS Combine and JS Combine External and Inline on, and the margin top of our plugin set to 60 px:

Load JS DeferredJS Deferred / Delayed ExcludesBefore any interactionAfter a mouse move and wheel
DeferreddefaultSticky at 60 pxSticky at 60 px
DelayeddefaultNot stickySticky at 60 px
Delayed+ quicksloth-sticky-widgetSticky at 10 px, the defaultStill at 10 px
Delayed+ quicksloth-sticky-widget and qsswConfigSticky at 60 pxSticky at 60 px

The same results in Chromium 153 and Firefox 155. With Fixed Widget 6.2.3 and Delayed, the widget was not pinned before the first interaction; with q2w3 in the excludes it was pinned from the start, as without LiteSpeed Cache. LiteSpeed's full page cache needs a LiteSpeed web server and was not part of our test; the optimization above runs on any server.

WP Rocket

WP Rocket is a paid plugin and not tested by us. From its documentation (Delay JavaScript execution, last updated 11 March 2026, and Troubleshoot Delay JavaScript execution issues, last updated 19 January 2026, both read on 4 November 2026):

Perfmatters

Perfmatters is a paid plugin and not tested by us. Its delay JavaScript documentation (updated 1 October 2026, read on 4 November 2026) puts the option under the plugin's settings, JavaScript menu, Delay section, Delay JavaScript. It has two behaviors:

Its optional timeout loads delayed scripts after 15 seconds without interaction; the documentation says it is off by default.

Autoptimize

The free Autoptimize 3.1.17 (released on 25 October 2026) has no option that waits for an interaction: its code offers aggregating and deferring under Settings → Autoptimize → JS, CSS & HTML. All three set-ups we tried kept our widget sticky at the 60 px we had set, before any interaction, in both browsers:

If another sticky plugin breaks with Autoptimize, add its folder name to Exclude scripts from Autoptimize:, a comma-separated list, and keep the entries that are already there. We have not looked at the options of Autoptimize Pro.

W3 Total Cache and SiteGround Speed Optimizer

Both are not tested by us; the labels come from the code of the versions on WordPress.org on 4 November 2026.

Cloudflare Rocket Loader

Rocket Loader is a Cloudflare setting, not a plugin, and not tested by us (it needs a site behind Cloudflare). Cloudflare says it defers "the loading of all of your JavaScript until after rendering" and "handles both inline and external scripts, while maintaining order of execution" (Rocket Loader, last updated 14 August 2026, read on 4 November 2026). It does not wait for an interaction, but there is no exclusion list either. Scripts are skipped only if their tag carries data-cfasync="false", which "must be added before the src attribute" (Ignore JavaScripts, last updated 17 April 2026).

If you need that for our plugin, this snippet adds the attribute to both of its script tags. Put it in a small plugin of your own, or in a code snippets plugin:

add_filter( 'script_loader_tag', function ( $tag, $handle ) {
	if ( 'qssw-sticky' === $handle ) {
		$tag = str_replace( '<script ', '<script data-cfasync="false" ', $tag );
	}
	return $tag;
}, 10, 2 );

On our test site with WordPress 7.1.4 the page then had <script data-cfasync="false" id="qssw-sticky-js-before"> and <script data-cfasync="false" id="qssw-sticky-js" src="…/sticky.js?ver=1.0.2">, and the widget still stuck at 60 px without Cloudflare. We could not check what Rocket Loader does with them. For Fixed Widget, use 'q2w3_fixed_widget' as the handle.

With Quicksloth Sticky Widget

What the plugin does, from its code (version 1.0.2):

The plugin is free in the WordPress.org Plugin Directory. More on what it does and what it does not do.

Quick check list

What you seeLikely causeFix
Sticks only after the first mouse move or touchDelay JavaScript (WP Rocket, LiteSpeed Delayed, Perfmatters)Exclude the plugin's file and its inline settings
Sticks, but ignores your margin or other settingsOnly the file is excludedAlso exclude the settings (qsswConfig for our plugin)
Works in Chrome, not in Firefox or SafariA delay that Chrome's load-time mouseover startsAs above
A new sticky widget does not stick for visitorsCached page from before the changeClear the cache
Broke after combining or minifyingOrder of combined files (often jQuery plugins)Exclude the plugin from combining

Sources

Related: why a sticky sidebar does not work in the first place, how to make a widget sticky, sticky sidebar in Astra, GeneratePress, Kadence and OceanWP and what AdSense allows for sticky sidebar ads. Still stuck with your optimizer? Write to support@quicksloth.dev with a link to the page and the name of the plugin.

Documentation and plugin code read on 4 November 2026; LiteSpeed Cache and Autoptimize tested the same day as described at the top. Written with AI tools and checked by Quicksloth.