> ## Documentation Index
> Fetch the complete documentation index at: https://documentation.onesignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# WordPress troubleshooting

> Comprehensive guide for troubleshooting common setup issues with OneSignal Web Push Notifications on WordPress, including browser compatibility (Chrome, Firefox, Safari), plugin integration, and resolving CDN or caching conflicts.

## Common setup issues

### Verify your OneSignal dashboard setup

Make sure you’ve completed each step in the [WordPress setup guide](./wordpress):

* Select the **WordPress Plugin** option when creating your OneSignal app
* Your Site URL must exactly match the browser URL
  * For example, `https://example.com` is **not** the same as `https://www.example.com`. Use one version consistently.
  * Only one site origin is supported for push. See [Same-origin policy](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy).
* Make sure you've added at least one permission prompt.

### Do not add the OneSignal code manually

The OneSignal WordPress plugin **automatically** includes the initialization script and Service Worker.

* Do **not** add OneSignal JavaScript `init` code to your site.
* Do **not** use the [Custom Code Setup](./web-push-custom-code-setup) with the WordPress plugin. If you need to customize the `init` method, **uninstall the plugin** and add the code and Service Worker manually.

### Send notification when post published

When you publish a post, page, or custom post type, OneSignal can automatically send a notification to your subscribers.

<Frame caption="OneSignal Push Notifications metabox—drag to reposition if needed">
  <img src="https://mintcdn.com/onesignal/kAXbp86YqdTAbPtE/images/web-push/onesignal-push-notifications-metabox-wordpress.png?fit=max&auto=format&n=kAXbp86YqdTAbPtE&q=85&s=428a477e16f85fa50f9ff69678304340" alt="OneSignal Push Notifications metabox—drag to reposition if needed" width="3252" height="1674" data-path="images/web-push/onesignal-push-notifications-metabox-wordpress.png" />
</Frame>

If you do not see the **Send notification when post is published or updated** checkbox, check these items:

1. Check the metaboxes to the right and bottom of the editor. You can drag and drop as needed.
2. Check the Screen Options at the top of the editor to make sure the **OneSignal Push Notifications** metabox is checked.

<Frame caption="Screen Options showing OneSignal Push Notifications metabox checked">
  <img src="https://mintcdn.com/onesignal/kAXbp86YqdTAbPtE/images/web-push/wordpress-screen-options-onesignal-push-notifications-metabox-checked.png?fit=max&auto=format&n=kAXbp86YqdTAbPtE&q=85&s=fd11371fd17a5d66fec241bcc2ff5084" alt="Screen Options showing OneSignal Push Notifications metabox checked" width="1896" height="330" data-path="images/web-push/wordpress-screen-options-onesignal-push-notifications-metabox-checked.png" />
</Frame>

3. Check if using a Custom Post Type. This is usually found in the URL as `post_type=your_custom_type`. If so, add the custom post type to the **Custom Post Types** field in the [OneSignal WordPress plugin settings](./wordpress#add-a-custom-post-type-to-onesignal-wordpress-plugin).

<Frame caption="Example where to find the custom post type name">
  <img src="https://mintcdn.com/onesignal/kAXbp86YqdTAbPtE/images/web-push/wordpress-find-custom-post-types-field.png?fit=max&auto=format&n=kAXbp86YqdTAbPtE&q=85&s=3239d37ca790551c1fd3685f8424f319" alt="OneSignal WordPress plugin settings showing Custom Post Types field" width="1154" height="894" data-path="images/web-push/wordpress-find-custom-post-types-field.png" />
</Frame>

***

## How to troubleshoot your site

<Steps>
  <Step title="Verify plugin is active and open developer tools">
    Load your site in a normal (non-incognito) browser window with the plugin enabled.

    <Frame caption="Right-click your site, click Inspect, and open the Console tab.">
      <img src="https://mintcdn.com/onesignal/3zq1PvSaqvUE2bIx/images/docs/28c27ab14a40621fbcc2c4168d49a2bf72088536a669be59c160b7a30a7fcd95-Screenshot_2025-02-27_at_10.39.27_AM.png?fit=max&auto=format&n=3zq1PvSaqvUE2bIx&q=85&s=38d793be0784bcfd8acee745e3757dcf" alt="Browser DevTools open with the Console tab selected on a WordPress site" width="1814" height="1024" data-path="images/docs/28c27ab14a40621fbcc2c4168d49a2bf72088536a669be59c160b7a30a7fcd95-Screenshot_2025-02-27_at_10.39.27_AM.png" />
    </Frame>
  </Step>

  <Step title="Check the console for OneSignal errors">
    Open the **Console** tab, refresh the page, and look for any red or yellow OneSignal-related errors.
    See [Common OneSignal console errors](#common-onesignal-console-errors) for help.
  </Step>

  <Step title="Check subscription status in the browser">
    After the page finishes loading and you see no OneSignal errors in the Console, paste:

    ```javascript JavaScript theme={null}
    OneSignal.User.PushSubscription.id
    ```

    If the visitor is subscribed, this returns a string (the Subscription ID). If they are not subscribed or the subscription is not ready yet, you may see **`null`** or an empty value. If you see **`OneSignal is not defined`**, wait a few seconds and try again, or fix Console errors from [Common OneSignal console errors](#common-onesignal-console-errors) first—the SDK may still be loading via the deferred loader.

    <Frame caption="Find your OneSignal Subscription ID in the console.">
      <img src="https://mintcdn.com/onesignal/tc0EvmtSSX56SX0c/images/docs/96cdeebdc8888b5c49b6466bf6975a75fb9497f7e54d34f7da3d6c25b35250ae-Screenshot_2025-02-27_at_11.15.16_AM.png?fit=max&auto=format&n=tc0EvmtSSX56SX0c&q=85&s=f396b737c9cd56257c59d6515086aec6" alt="Browser console showing OneSignal User PushSubscription id string result" width="1258" height="448" data-path="images/docs/96cdeebdc8888b5c49b6466bf6975a75fb9497f7e54d34f7da3d6c25b35250ae-Screenshot_2025-02-27_at_11.15.16_AM.png" />
    </Frame>
  </Step>

  <Step title="Verify Subscription ID in OneSignal dashboard">
    In the **OneSignal dashboard**, go to **Audience > Subscriptions** and search for the ID returned above.

    <Frame caption="Search your OneSignal dashboard for the Subscription ID.">
      <img src="https://mintcdn.com/onesignal/Z6xkXGfmy814If53/images/docs/e3907be9912e3ed3a934c6968f2e6f9354af519b8c670d1f7de07f32e71a8a80-Screenshot_2025-02-27_at_11.18.06_AM.png?fit=max&auto=format&n=Z6xkXGfmy814If53&q=85&s=76657b84cf0f8f29fa03a776f26cf66c" alt="OneSignal dashboard Subscriptions search field with subscription ID lookup" width="2726" height="780" data-path="images/docs/e3907be9912e3ed3a934c6968f2e6f9354af519b8c670d1f7de07f32e71a8a80-Screenshot_2025-02-27_at_11.18.06_AM.png" />
    </Frame>
  </Step>

  <Step title="Send a test push notification">
    If the subscription exists and status is **Subscribed**, follow the [Push guide](./push) to send a notification.
    If nothing appears, see [Notifications not shown](./notifications-not-shown-web-push) for browser-specific fixes.
  </Step>
</Steps>

***

## Common OneSignal console errors

### <Danger>SdkInitError: OneSignal: This web push config can only be used on ... Your current origin is ...</Danger>

<Frame caption="Site URL mismatch error.">
  <img src="https://mintcdn.com/onesignal/_KaXe4GQkxsEfa17/images/docs/334686c64af6155f95d674d0cfd28a5b92739f3cae57382073365ec9206b7e7c-Screenshot_2025-02-27_at_11.35.59_AM.png?fit=max&auto=format&n=_KaXe4GQkxsEfa17&q=85&s=2d8d0656875180f0b77dd88795a4bced" alt="Console SdkInitError showing web push config origin mismatch" width="2090" height="192" data-path="images/docs/334686c64af6155f95d674d0cfd28a5b92739f3cae57382073365ec9206b7e7c-Screenshot_2025-02-27_at_11.35.59_AM.png" />
</Frame>

Your site URL in the OneSignal dashboard doesn’t match your actual domain.
Make sure it exactly matches the domain you see in the browser.

### <Danger>PushPermissionNotGrantedError: The user dismissed the permission prompt.</Danger>

The visitor declined the browser prompt. It won’t appear again until a cooldown period expires.
See [Web permission prompts](./permission-requests) for browser rules or clear site data to retry immediately.

### <Danger>The OneSignal web SDK can only be initialized once.</Danger>

<Frame caption="Duplicate OneSignal initialization error.">
  <img src="https://mintcdn.com/onesignal/Xl2NHJvxakrK4JbL/images/docs/e88d53c6c92a546f188c06e14e1776da8ad63c658c64044b6a674802ce2a2277-Screenshot_2025-02-27_at_2.40.32_PM.png?fit=max&auto=format&n=Xl2NHJvxakrK4JbL&q=85&s=cc2d3a0773b894f423f0d6db598a37a1" alt="Console error OneSignal web SDK can only be initialized once" width="2164" height="182" data-path="images/docs/e88d53c6c92a546f188c06e14e1776da8ad63c658c64044b6a674802ce2a2277-Screenshot_2025-02-27_at_2.40.32_PM.png" />
</Frame>

You're loading OneSignal twice. Remove manually added OneSignal code if you're using the plugin.

### <Danger>Installing service worker failed.. 403 or 404 error</Danger>

<Frame caption="Service Worker file missing (403/404).">
  <img src="https://mintcdn.com/onesignal/tc0EvmtSSX56SX0c/images/docs/990e505-Screen_Shot_2020-02-01_at_9.31.44_PM.png?fit=max&auto=format&n=tc0EvmtSSX56SX0c&q=85&s=0d719e6b826477612901d07e1d505f15" alt="Console error installing service worker failed with 403 or 404" width="3364" height="200" data-path="images/docs/990e505-Screen_Shot_2020-02-01_at_9.31.44_PM.png" />
</Frame>

Make sure this file is accessible (replace `your-site.com` and match your **actual plugin folder name** if it differs from the default):

`https://your-site.com/wp-content/plugins/onesignal-free-web-push-notifications/sdk_files/OneSignalSDKWorker.js`

If not, see [Common plugin support](#common-plugin-support) to fix CDN or caching issues.

***

## Common plugin support

CDNs and caching plugins can block OneSignal’s required files. Paths below assume the plugin directory is **`onesignal-free-web-push-notifications`**; adjust if your install uses a different folder name.

Use these plugin-specific settings:

### Autoptimize

In **Excluded scripts**, add:

```
wp-content/plugins/onesignal-free-web-push-notifications/sdk_files/(.*)
```

### WP Rocket

Under **CDN > Exclude Files From CDN**, add:

```
(.*)/onesignal-free-web-push-notifications/sdk_files/(.*)
```

### LiteSpeed Cache

Under **CDN > Exclude Path**, add:

```
(.*)/onesignal-free-web-push-notifications/sdk_files/(.*)
```

Then press save.

### WP Super Cache

1. Go to **Settings > WP Super Cache > CDN**
2. In **Exclude if substring**, include: `onesignal-free-web-push-notifications`
3. Click **Contents** > **Delete Cache**

### WP Engine

WP Engine can rewrite plugin URLs through its CDN. **HTML Post-Processing** rules are environment-specific; the snippet below is an **example only**—confirm paths with [WP Engine support](https://wpengine.com/support/) or your User Portal before applying.

In the WP Engine **plugin > General Settings > HTML Post-Processing**, you may need rules similar to the following. Replace every placeholder with values from **your** site and WP Engine CDN hostname:

| Placeholder            | Replace with                                                            |
| ---------------------- | ----------------------------------------------------------------------- |
| `YOURSITEHERE`         | Your bare domain (regex segment), e.g. `example` for `example.com`      |
| `mywpenginehandleHere` | Your WP Engine install name (subdomain before `.wpengine.com`)          |
| `wpengineCDNpathHere`  | Your NetDNA / CDN path segment from WP Engine (often shown in CDN URLs) |
| `mywebsiteHere`        | Your live site origin without path, e.g. `https://example.com`          |

```text theme={null}
#https?://(www\.)?(YOURSITEHERE\.com|mywpenginehandleHere.wpengine.com|wpengineCDNpathHere.wpengine.netdna-(ssl|cdn).com)/wp-(content|includes)#
=> https://wpengineCDNpathHere-wpengine.netdna-ssl.com/wp-$4
#https://wpengineCDNpathHere-wpengine.netdna-ssl.com/plugins/onesignal-free-web-push-notifications/#
=> https://mywebsiteHere.com/wp-content/plugins/onesignal-free-web-push-notifications/
#https://wpengineCDNpathHere-wpengine.netdna-ssl.com/wp-content/plugins/onesignal-free-web-push-notifications/#
=> https://mywebsiteHere.com/wp-content/plugins/onesignal-free-web-push-notifications/
```

### W3 Total Cache

1. Go to **Performance > CDN**
2. Under **Rejected files**, add:

```
{plugins_dir}/onesignal-free-web-push-notifications/sdk_files/*
```

<Frame caption="W3 Total Cache exclusion settings.">
  <img src="https://mintcdn.com/onesignal/MUgio66t0sYhGEvj/images/docs/64ad121-Screen_Shot_2020-03-02_at_7.36.18_PM.png?fit=max&auto=format&n=MUgio66t0sYhGEvj&q=85&s=1b7d1eb06d32c8beef4026a70111dcdb" alt="W3 Total Cache CDN rejected files list including OneSignal sdk_files path" width="1071" height="494" data-path="images/docs/64ad121-Screen_Shot_2020-03-02_at_7.36.18_PM.png" />
</Frame>

### BunnyCDN

Exclude *onesignal* in the plugin's CDN Excluded Paths.

<Frame caption="BunnyCDN exclusion example.">
  <img src="https://mintcdn.com/onesignal/ciRrThfP6xMpI7GY/images/docs/025f46c1159398106997c97a61ad26ffe4ecd6f7a068dcd6e3f743762e6e697b-Screenshot_2024-11-19_at_9.34.35_AM.png?fit=max&auto=format&n=ciRrThfP6xMpI7GY&q=85&s=d893359f9da931a9db313391a58cf1ca" alt="BunnyCDN WordPress plugin excluded paths including onesignal" width="1830" height="518" data-path="images/docs/025f46c1159398106997c97a61ad26ffe4ecd6f7a068dcd6e3f743762e6e697b-Screenshot_2024-11-19_at_9.34.35_AM.png" />
</Frame>

### CDN Enabler

In Settings > CDN Enabler, add this to "Exclusions":

```
onesignal-free-web-push-notifications
```

### PressCDN

In Exclude Directories, add:

```
/wp-content/plugins/onesignal-free-web-push-notifications/
```

### Breeze

In **Settings > CDN > Exclude Content**, add:

```
/onesignal-free-web-push-notifications/sdk_files/
```

<Frame caption="Breeze exclusion example.">
  <img src="https://mintcdn.com/onesignal/Z6xkXGfmy814If53/images/docs/e0ea4ad-Screen_Shot_2020-06-30_at_7.59.26_PM.png?fit=max&auto=format&n=Z6xkXGfmy814If53&q=85&s=c12fed5c62e460beec878171e940928d" alt="Breeze CDN exclude content field with OneSignal sdk_files path" width="1219" height="552" data-path="images/docs/e0ea4ad-Screen_Shot_2020-06-30_at_7.59.26_PM.png" />
</Frame>

### Hummingbird Pro

Go to **Hummingbird > Asset Optimization**. Under **JavaScript** (and **CSS** if OneSignal assets appear there), locate files whose URLs contain **`onesignal-free-web-push-notifications`** or **`OneSignalSDK`**. **Exclude** them from minification/combination/defer, or switch those assets to **Don't load** optimization so the plugin does not rewrite or delay them.

<Frame caption="Hummingbird Pro Asset Optimization.">
  <img src="https://mintcdn.com/onesignal/RWtLFPeffHrC81wI/images/docs/a888a91-PastedGraphic-4_3.png?fit=max&auto=format&n=RWtLFPeffHrC81wI&q=85&s=e376446d64ec7fa8a8067ac7e8e551ba" alt="Hummingbird Pro asset optimization list showing script exclusions" width="476" height="90" data-path="images/docs/a888a91-PastedGraphic-4_3.png" />
</Frame>

### Sucuri

Follow [Sucuri's Whitelist guide](https://kb.sucuri.net/firewall/Whitelist+and+Blacklist/whitelist-file-folder) to allow OneSignal files.

### Solid Security (formerly iThemes Security)

Disable **Disable PHP in Plugins** (or equivalent) under **System Tweaks** so `OneSignalSDKWorker.js.php` can run.

<Frame caption="Disable blocking PHP execution in plugins for OneSignal.">
  <img src="https://mintcdn.com/onesignal/KSCNwSpBCNSQ8xdF/images/docs/f78a21b-php-in-plugins.jpg?fit=max&auto=format&n=KSCNwSpBCNSQ8xdF&q=85&s=ee27f7a8662e6f8e2b001056b22aa904" alt="Security plugin setting to allow PHP in plugins unchecked or disabled" width="818" height="188" data-path="images/docs/f78a21b-php-in-plugins.jpg" />
</Frame>

### Defender Security plugin

Do not enable "Prevent PHP execution".
Go to Defender Plugin > Security Tweaks and verify the setting is disabled.

### Example .htaccess for Service Worker access

```apache theme={null}
<Files *.php>
Order allow,deny
Deny from all
</Files>
<Files OneSignalSDKWorker.js.php>
Allow from all
ForceType 'application/javascript; charset=UTF-8'
</Files>
<Files OneSignalSDKWorker.js>
Allow from all
ForceType 'application/javascript; charset=UTF-8'
</Files>
```

<Note>
  Apache 2.4+ often uses `Require all denied` / `Require all granted` instead of `Order allow,deny`. Ask your host or adjust the rules to match your server’s Apache version.
</Note>

***

## Server slowdowns or site unreachable after sending notifications

If your server experiences slowdowns or becomes unreachable after sending notifications, it is often due to increased load from notification assets or limited server resources.

### Do not host your own notification icons

Avoid self-hosting images used in notifications. When you host your own notification icons or images, your server may become overloaded as every recipient’s browser attempts to fetch the image at the same time a notification is sent.
To reduce server strain, use image hosting solutions or CDN services optimized for high-concurrency access.

### Consider upgrading hosting resources

If server issues persist, you may need to:

* **Upgrade your hosting plan:** Higher bandwidth or more powerful hosting may be necessary to handle large-scale notification sends.
* **Consult your hosting provider:** Your provider can offer insights or optimizations specific to your hosting environment.

***
