Push Notifications Not Working with LiteSpeed Cache or WP Rocket

Almost every "it does not work" report is a caching plugin. These exact exclusions fix an empty subscriber list and a popup that never shows.

If the popup does not show, the subscriber list stays empty, or notifications never arrive, a caching plugin is the first suspect. Caching and speed plugins combine, delay or store files in ways that can break push. Two settings fix almost every case.

Symptoms

  • The bell shows for some visitors and not others.
  • The browser console says WPPN is undefined.
  • Visitors say they subscribed, but the Subscribers tab is empty.
  • The thank-you popup does not appear after clicking Allow.
  • After an update, the old design still shows.

Fix 1: exclude the plugin’s script from JavaScript optimization

A JavaScript optimizer can run subscribe.js before the small script that gives it its settings, and then it silently does nothing. Add all three entries to every JavaScript exclusion list your caching plugin has:

WPPN
subscribe.js
/wp-content/plugins/wp-push-notify/assets/js/subscribe.js

LiteSpeed Cache: go to Page Optimization, then Tuning. Paste all three lines, one per line, into JS Excludes, JS Deferred / Delayed Excludes and Guest Mode JS Excludes. Save, then purge all.

WP Rocket: go to File Optimization and add subscribe.js to the excluded JavaScript boxes for minify, combine, deferred loading and Delay JavaScript execution.

Autoptimize: go to JavaScript Options and use Exclude scripts from Autoptimize.

Any other plugin: look for lists named exclude JS, defer, delay and combine, and add the same entries to each.

Fix 2: never cache the service worker addresses

A cached copy of the service worker breaks subscribing, and it can break saving the subscriber and showing the thank-you popup at the same moment. Add these four addresses to your caching plugin’s “do not cache” list:

/wppn-sw.js
/wppn-manifest.json
/wp-json/wppn/
/wp-content/plugins/wp-push-notify/sw/wppn-worker.php

The plugin already tells WP Rocket and W3 Total Cache to leave these alone, but LiteSpeed Cache needs them added by hand under Cache, then Excludes, then Do Not Cache URIs, one address per line.

After you save

  1. Purge everything, including your CDN.
  2. On the device you test with, unregister the old service worker. On desktop, open DevTools, then Application, then Service Workers, then Unregister.
  3. Reload and subscribe again.

Still stuck? Look at the console

Press F12, open the Console tab and reload the page. Any line that starts with WPPN: says what went wrong. The plugin also repairs its own route when you open wp-admin, and it sends no-cache signals itself, but a cache that was already broken needs one manual purge.

More fixes are in the troubleshooting guide. If you use an iPhone, read the iPhone fix too.

Sujit Show

Developer of WP Push Notify, the self-hosted push notification plugin for WordPress. Visit the main site

1 comment

Leave a Reply

Your email address will not be published. Required fields are marked *