# Customize OneSignal prompt text: acceptButton, cancelButton

URL: https://wp24x7.com/how-to-customize-onesignal-prompt-text/
Updated: 2026-11-29
Type: blog post
Audience: WordPress developers using OneSignal push notifications

> OneSignal asks visitors for permission to send push notifications. If your custom button text does not appear, the usual cause is the wrong option name for the prompt type. The slide prompt uses acceptButton and cancelButton inside a text object under promptOptions. This guide shows the code, a checklist of why the text does not change, tips on wording and languages, and how to test.

## Key facts

- For: developers customising OneSignal prompt wording on WordPress sites
- Slide prompt: use text.acceptButton and text.cancelButton inside slidedown.prompts
- Old popup prompt: used acceptButtonText and cancelButtonText, now largely obsolete
- Cannot change: the browser's native Allow and Block dialog
- Check first: wrong option names, dashboard overrides, cached script, two inits
- Caveat: OneSignal changes its SDK; compare option names with current documentation

OneSignal asks visitors for permission to send push notifications. If your custom button text does not appear, **the usual cause is the wrong option name for the type of prompt you are using. The slide prompt uses `acceptButton` and `cancelButton` inside a `text` object.** This guide is about the prompt wording, separate from the service worker setup in our [OneSignal and PWA guide](/how-to-integrate-onesignal-with-pwa-in-wordpress-website).

> **Quick answer**
For the slide prompt, set `text.acceptButton` and `text.cancelButton` inside `promptOptions.slidedown.prompts`. Option names ending in `Text` belong to the old popup. OneSignal changes its SDK over time, so compare names with its current documentation, and back up and test on staging.

## Which prompts does OneSignal show?

| Prompt | Can you edit it? | Notes |
|:--|:--|:--|
| Browser native permission dialog | No | The browser owns the Allow or Block box |
| Slide prompt (slidedown) | Yes | OneSignal's banner that asks first, then triggers the native dialog |
| Older HTTP or popup prompt | Yes, with `Text` suffix options | Largely obsolete since all sites should use HTTPS |

Customising the wrong one explains many "it does nothing" reports. Earlier documentation mixed these up, which is why `acceptButtonText` on a slide prompt silently failed.

## What is the code for the slide prompt?

Inside your `OneSignal.init()` call, set `promptOptions`:

```js
window.OneSignalDeferred = window.OneSignalDeferred || [];
OneSignalDeferred.push(async function (OneSignal) {
	await OneSignal.init({
		appId: "YOUR-APP-ID",
		promptOptions: {
			slidedown: {
				prompts: [
					{
						type: "push",
						autoPrompt: true,
						text: {
							actionMessage: "Get a short alert when we publish something new.",
							acceptButton: "Yes, notify me",
							cancelButton: "No thanks"
						},
						delay: {
							pageViews: 2,
							timeDelay: 10
						}
					}
				]
			}
		}
	});
});
```

| Option | What it does |
|:--|:--|
| `type: "push"` | The prompt for push notifications (others cover email and SMS categories) |
| `autoPrompt: true` | Shows it automatically once the delay rules are met; `false` to show it from a button |
| `actionMessage` | The question; keep it short and honest |
| `acceptButton`, `cancelButton` | The two button labels |
| `delay.pageViews`, `delay.timeDelay` | Postpone the prompt (seconds for timeDelay) |

If the WordPress plugin initialises OneSignal for you, look for these prompt settings in its screens first. If you need code, turn off the plugin's initialisation, otherwise you will get two inits.

## Why does the text not change?

1. **Wrong option names.** Slide prompts use `acceptButton` and `cancelButton`; names ending in `Text` belong to the older popup.
2. **Wrong location.** The `text` object must be inside the prompt object, inside `slidedown.prompts`.
3. **Dashboard overrides.** Prompts configured in OneSignal's dashboard may apply instead of your code. Change them in one place.
4. **Cached script.** A caching or optimisation plugin may serve an old init script. Clear it and exclude OneSignal scripts from minification and delay.
5. **Already subscribed or dismissed.** Test in a private window or clear site data.
6. **Two inits.** Check the page source for more than one `OneSignal.init`.
7. **Invalid config.** A stray comma or quote breaks the script; check the browser console.

## How should I write good prompt text?

Short and specific beats clever. Tell visitors what they will get and how often, for example "Get an email-free alert when we post new guides." A clear cancel label such as "Not now" keeps the choice friendly. Do not mislead with fake system styling or imply that notifications are required. Browsers may drop sites with poor permission practices, and a high Block rate can reduce your future ability to ask. If the site is in the EU or UK, remember consent and privacy notice requirements, and ask your legal adviser how push subscriptions are treated for your business. Delay the prompt, or show it after a meaningful action such as finishing an article.

_Ask first with your own prompt, then the browser's dialog_

## What about several languages?

Set the prompt text per language. OneSignal's SDK supports localised prompt text, and you can pick the language from your multilingual plugin's current locale in PHP and print the matching strings into the init script with `wp_json_encode()`. Keep translations short, because slide prompts have limited space, and test the longest language on a phone.

## How do I test it?

1. Open a private window, to avoid saved dismissals.
2. Visit enough pages to satisfy `delay.pageViews`.
3. Confirm the slide prompt shows your text.
4. Click accept and check the browser's native dialog appears, which is expected.
5. Check **Application, Service Workers** in DevTools for an active worker, and that the subscription appears in OneSignal's **Audience** list.

If the manifest or install banner gives separate errors, see the guide on the [PWA manifest short_name](/how-to-add-short-name-to-pwa-manifest).

**Want push notifications integrated and tested?**
Our team integrates them and tests across browsers.
[WordPress development](/wordpress-development)
[Plugin development](/wordpress-plugin-development)

## Frequently asked questions

### Why does my custom prompt text not change?

Usually the option name does not match the prompt type. Slide prompts use acceptButton and cancelButton, while older HTTP popup prompts used acceptButtonText and cancelButtonText.

### Can I change the text of the browser's own permission dialog?

No. The native Allow and Block dialog is controlled by the browser. You can only customise the OneSignal prompt that appears before it.

### Where do I put the code?

In the init call for the OneSignal SDK that you load from a child theme or small plugin, or in the plugin's own prompt settings if it offers them.

### What is the slide prompt?

OneSignal's own banner, also called slidedown, that asks first and then triggers the native dialog. You can change its message and buttons.

### What do delay.pageViews and delay.timeDelay do?

They postpone the prompt so it does not interrupt a first-time visitor. pageViews waits for a number of page views and timeDelay waits a number of seconds.

### My dashboard settings and my code disagree. Which wins?

Prompts configured in OneSignal's dashboard may apply instead of your code, depending on the SDK version. Change them in one place.

### Why does the prompt not show on repeat tests?

OneSignal remembers a dismissal or an existing subscription. Test in a private window or clear site data, then reload.

### The plugin already initialises OneSignal. What do I do?

Look for prompt settings in the plugin's own screens first. If you need code, turn off the plugin's initialisation, otherwise you get two inits.

### How do I write good prompt text?

Short and specific. Tell visitors what they will get and how often, use a friendly cancel label such as Not now, do not imply notifications are required, and delay the prompt until after a meaningful action.

### Do I need to think about consent rules?

If the site is in the EU or UK, consent and privacy notice requirements apply. Ask your legal adviser how push subscriptions are treated for your business.

### Can I translate the prompt?

OneSignal's SDK supports localised prompt text. Pick the language from your multilingual plugin's locale in PHP and print the strings into the init script with wp_json_encode, keeping translations short.

### Can you integrate push notifications for me?

Yes. Our WordPress development team integrates push notifications and tests them across browsers, and the plugin development service can build custom prompt logic.
