Demonstrates the scaffolding for an AI experiment without touching the editor or admin UI. When enabled, it appends a diagnostic HTML comment in the site footer, tweaks the document title in debug mode, and exposes a simple REST endpoint so developers can confirm the experiment loader is working.
wp_footer→ outputs<!-- Example Experiment: AI Plugin Active -->for logged-in users.document_title_parts→ appends[AI]to the site title whileWP_DEBUGis true.rest_api_init→ registersGET /wp-json/ai/v1/example.
- No abilities or JavaScript bundles. The REST route returns metadata about the experiment (ID, label, enabled state) for quick verification.
- Enable the experiment in the AI settings screen (or ensure it’s active by default).
- Visit the front end while logged in and inspect the page source—look for the footer comment.
- Hit
/wp-json/ai/v1/exampleas an admin; expect a JSON payload describing the experiment.
- Permission callback for the REST route requires
manage_options, ensuring only admins fetch metadata. - Useful as a template when creating new experiments—copy the structure, rename, and expand with real functionality.