A WordPress plugin that:
- injects the WordLift Cloud bootstrap script into the frontend, and
- manages an
Entity Typetaxonomy (wl_entity_type) on post edit screens. - provides optional backend telemetry for authenticated admin usage via plugin settings.
- Clone or download this repository.
- Upload the
wordlift-cloud-pluginfolder to your WordPresswp-content/plugins/directory. - Activate the plugin in the WordPress admin dashboard.
Use Docker:
./scripts/dev upThis starts MySQL + WordPress, installs WordPress if needed, and activates this plugin. It also installs and activates the Classic Editor plugin, and sets Classic Editor as default.
Defaults:
- Site URL:
http://localhost:8090 - Admin user:
admin - Admin password:
admin
Useful commands:
./scripts/dev down
./scripts/dev reset
./scripts/dev logs
./scripts/dev wp plugin listClassic editor defaults configured by setup:
classic-editor-replace = classicclassic-editor-allow-users = 1
- Injects
<script async type="text/javascript" src="https://cloud.wordlift.io/app/bootstrap.js"></script>intowp_head.- consent gate filter:
wordlift_cloud_has_bootstrap_consent(defaults totrue)
- consent gate filter:
- Registers the
wl_entity_typetaxonomy for public post types (except attachments). - Uses a custom
Entity Typemetabox (classic and block editor legacy metabox area) with:Selected(always-visible summary of currently checked terms with live count)AllMost UsedA-Z(flat alphabetical list)
- Supports selecting multiple entity types (checkbox behavior).
- Adds a Classic Editor metabox tab fallback script to keep
All/Most Used/A-Ztab switching reliable. - Excludes
DataTypeand allDataTypedescendants from selectable Entity Types. - Optional telemetry integration:
- configurable in
Settings > WordLift Cloud - admin UI field: enable/disable only
- loaded in WordPress admin only (no public frontend telemetry snippet)
- tracks backend authenticated feature usage (metabox interactions, settings usage, taxonomy management)
- consent gate filter:
wordlift_cloud_has_analytics_consent(defaults totrue)
- configurable in
- Outputs selected entity type(s) on singular frontend pages as one meta per term:
<meta name="wl:entity_type" content="{term-slug}" />
- Bootstraps and updates taxonomy terms from a distilled Schema.org dataset:
- source:
https://schema.org/version/latest/schemaorg-current-https.jsonld - distilled data file:
resources/schemaorg/schema-classes.distilled.json
- source:
- WPML compatibility:
- ships
wpml-config.xmlto keepwl_entity_typenon-translatable - removes non-canonical slugs (for example language-suffixed duplicates) during sync
- sync runs on plugin activation and plugin update (admin path), not on every page load
- ships
Regenerate the distilled dataset:
php scripts/build-schemaorg-distilled.phpThe distiller extracts rdfs:Class nodes, rewrites names into canonical slugs (for example AMRadioChannel -> am-radio-channel, CreativeWork -> creative-work, WPHeader -> wp-header), and stores parent/child relationships for taxonomy sync.
Install dependencies and run tests:
composer install
composer test
composer test:coverageCoverage is configured for all plugin source files under includes/.
- Plugin runtime is orchestrated by a bootstrap container (
Wordlift_Cloud_Bootstrap) that wires services through interfaces:Wordlift_Cloud_Hookable_ServiceWordlift_Cloud_Activatable_ServiceWordlift_Cloud_Analytics_Provider
- Core services are instantiated via
Wordlift_Cloud_Bootstrap::build_default().
To gate telemetry loading on your consent mechanism:
add_filter(
'wordlift_cloud_has_analytics_consent',
function ( $has_consent ) {
// Replace with your CMP/cookie check.
return isset( $_COOKIE['analytics_consent'] ) && 'yes' === $_COOKIE['analytics_consent'];
}
);Telemetry credential configuration (hidden from admin UI):
define( 'WORDLIFT_CLOUD_POSTHOG_PROJECT_TOKEN', 'phc_xxx' );
define( 'WORDLIFT_CLOUD_POSTHOG_API_HOST', 'https://eu.i.posthog.com' );Optional filters:
wordlift_cloud_posthog_project_tokenwordlift_cloud_posthog_api_host