# WordPress (https://notert.io/docs/platforms/wordpress)

Last updated 2026-11-27

WordPress needs no plugin of Notert's: the widget is the snippet from your install guide, placed where WordPress puts code on every page. Pick the way that suits your site:

| Way                                                    | Best for                                               | Survives a theme switch |
| ------------------------------------------------------ | ------------------------------------------------------ | ----------------------- |
| [A code snippets plugin](#with-a-code-snippets-plugin) | Most sites, with no code to write                      | Yes                     |
| [A must-use plugin](#with-a-must-use-plugin)           | Developers, and sites that name signed-in users        | Yes                     |
| [A child theme](#in-a-classic-child-theme)             | A classic theme you already customize in a child theme | No                      |

## Before you start [#before-you-start]

- **Copy your snippet.** In <Key to="settings">Settings</Key>, open <Key to="settings/conversations">General</Key> under Conversations and switch <Key>Conversations</Key> on if it's off. Then open <Key to="settings/conversations/widget">Widget</Key>, press <Key>Open guide</Key>, and copy it under Add it to your site. See [install the widget](/docs/getting-started/install-the-widget).
- **List your site's address.** Your site's address, as WordPress serves it, must be among the install guide's websites under Where it works. Adding `acme.com` covers `www.acme.com` and a staging site at `staging.acme.com` too. See [where the widget works](/docs/widget/where-it-works).
- **An administrator account.** Installing a plugin or adding files needs one. On WordPress.com, plugins and theme files need a plan that allows them.

## With a code snippets plugin [#with-a-code-snippets-plugin]

The simplest way, and it survives theme updates and theme switches. Any plugin that adds code to every page's header or footer works.

<Steps>
1. In your WordPress dashboard, install and activate a plugin that inserts code into your site's header or footer, if you don't have one already.
2. Open its settings and paste your snippet into the footer box, which places it before `</body>`. A header box works too: the widget waits for the page to load either way.
3. Save, then open a page of your site. The round button appears in the corner once the page has loaded, and within moments the install guide's Check it's live shows your site's address.
</Steps>

## With a must-use plugin [#with-a-must-use-plugin]

A must-use plugin is a single PHP file WordPress loads on every request, with no theme involved and nothing to activate. Create `wp-content/mu-plugins/notert-widget.php`, making the `mu-plugins` folder if it doesn't exist, and paste this, with your snippet's workspace id in place of `YOUR_WORKSPACE_ID`:

```php
<?php
/**
 * Plugin Name: Notert widget
 * Description: Adds the Notert support widget to every page.
 */

add_action( 'wp_footer', function () {
	?>
	<script>
	  window.$notert=window.$notert||[];window.notert=window.notert||new Proxy({},{get:(_,p)=>typeof p=="string"&&p!="then"&&/^[a-z]/i.test(p)?(...a)=>window.$notert.push([p,...a]):void 0});
	  window.notert.init("YOUR_WORKSPACE_ID",{widget:true,theme:"page"});
	</script>
	<script type="module" async src="https://app.notert.io/embed/v1.js"></script>
	<?php
} );
```

Themes call `wp_footer` at the end of every page, block themes included, so the widget shows on every page your theme draws. The plugin is listed under **Must-Use** on the Plugins page, and stays until you delete the file.

### Name your site's signed-in users [#name-your-sites-signed-in-users]

If people sign in to your WordPress site, as on a membership or course site, the same file can sign a token for each one, so their conversations follow them to every device and your team sees them as verified. First, copy your identity secret under Secrets on MCP & API, and add it to `wp-config.php`, above the line that says to stop editing:

```php
define( 'NOTERT_IDENTITY_SECRET', 'nis_your_secret' );
```

Then add this to `notert-widget.php`, below the code above. It signs the token with PHP alone, so there's nothing to install:

```php
function notert_base64url( $data ) {
	return rtrim( strtr( base64_encode( $data ), '+/', '-_' ), '=' );
}

function notert_token( WP_User $user ) {
	$now    = time();
	$claims = array(
		'sub'            => (string) $user->ID,
		'email'          => $user->user_email,
		'email_verified' => true,
		'iat'            => $now,
		'exp'            => $now + DAY_IN_SECONDS,
	);
	if ( '' !== $user->display_name ) {
		$claims['name'] = $user->display_name;
	}
	$header    = notert_base64url( wp_json_encode( array( 'alg' => 'HS256', 'typ' => 'JWT' ) ) );
	$payload   = notert_base64url( wp_json_encode( $claims ) );
	$signature = notert_base64url( hash_hmac( 'sha256', "$header.$payload", NOTERT_IDENTITY_SECRET, true ) );
	return "$header.$payload.$signature";
}

add_action( 'wp_footer', function () {
	if ( ! is_user_logged_in() || ! defined( 'NOTERT_IDENTITY_SECRET' ) ) {
		return;
	}
	?>
	<script>
	  window.notert.identify(<?php echo wp_json_encode( notert_token( wp_get_current_user() ) ); ?>);
	</script>
	<?php
}, 20 );
```

The `20` runs it after the snippet, so `window.notert` exists by then. The token says the user's email is confirmed, so sign only for users whose address your site has confirmed, such as by the email WordPress sends to set a password. What each claim means, and what makes a token fail, is in [sign a token on your server](/docs/signed-in-users/sign-a-token#php).

<Note>
A page cache must never serve a page carrying one person's token to someone else. Most caching
plugins skip signed-in users by default; check that yours does before you add this.
</Note>

## In a classic child theme [#in-a-classic-child-theme]

If you'd rather not add a plugin, and your theme is a classic one you customize through a child theme, paste the snippet into the child theme's `footer.php`, just before `</body>`. Paste it into the child theme, never the theme itself, so an update to the theme doesn't take it away.

A block theme has no `footer.php` to edit: use a code snippets plugin or a must-use plugin instead.

## If it doesn't appear [#if-it-doesnt-appear]

- **A performance plugin holds it back.** A plugin that combines, defers or delays scripts until the visitor interacts can hold the widget back. Exclude the snippet and `https://app.notert.io/embed/v1.js` from those settings, often by adding `notert` to the plugin's list of scripts to leave alone.
- **Cloudflare Rocket Loader.** If your site is behind Cloudflare with Rocket Loader on, it can rewrite the snippet's scripts. Add `data-cfasync="false"` to both of the snippet's `<script>` tags so Rocket Loader leaves them alone.
- **The console says why.** Open the browser's console on a page of your site and look for a line starting `Notert:`. See [troubleshooting](/docs/widget/troubleshooting).