WP Manifestindependent plugin directory
manifest / integrations / wordland-site-id

WordLand Site ID

Prints a theme-agnostic data element containing a stable global site ID (WP.com API → Jetpack → Null).

by WordLand · github.com/scotthansonde/wordland-site-id · website

★ 1stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/scotthansonde/wordland-site-id/archive/refs/heads/main.zip

WordLand Site ID is a small WordPress plugin that prints a hidden, theme-agnostic data element with a stable global site ID.

The site ID is used by WordLand to connect WordPress sites to WordLand experiences.

It resolves the ID in this order:

  1. WordPress.com public REST API, cached for 12 hours.
  2. Jetpack's connected WordPress.com site ID.
  3. null when no global ID is available.

Output

The plugin prints once on public frontend requests:

<div
  id="wordland-siteId"
  data-siteId="123"
  data-site-id="123"
  data-siteId-source="wpcom-api"
  data-site-id-source="wpcom-api"
  data-blogId="1"
  data-blog-id="1"
  hidden
></div>

Both camelCase and kebab-case data-* attributes are emitted for compatibility with the original one-off integration and conventional HTML data attributes.

Theme Compatibility

Automatic output requires the active theme to call wp_footer() or wp_body_open(). Most WordPress themes do; themes that omit both hooks will not receive the hidden data element automatically.

Local Development

This repository includes a .wp-env.json file for local development with @wordpress/env.

Requires Node.js 20.10.0 or newer.

npm install
npm run env:start

Then open the local WordPress site provided by wp-env and activate WordLand Site ID.

Release Checklist

  1. Update the plugin header version in wordland-site-id.php.
  2. Update package.json and package-lock.json, for example with npm version <version> --no-git-tag-version.
  3. Run npm run lint:php.
  4. Test the plugin in wp-env.
  5. Tag the release in GitHub.

License

GPL-2.0-or-later