Docs / Developers

Developers & integrations

The data attributes, options, database tables, and coexistence rules you need if you're extending or debugging LHAI.

Data attribute reference

LHAI uses a handful of custom data-* attributes to mark up the DOM. All of them ship with the published HTML so they survive edit, export, and manual copy-paste.

AttributeOnPurpose
data-lhai-image<div> or <img>Image placeholder prompt. The image engine reads this to generate the image. data-ai-image is accepted as an alias.
data-lhai-elAny elementStable ID for scoping per-element Custom CSS. Assigned lazily when the user first opens Custom CSS.
data-lhai-webhook<form>Outbound webhook URL for form submissions.
data-lhai-thankyou<form>Redirect URL on successful submission.
data-lhai-success-msg<form>Custom success-card text.

Custom CSS scoping

When you open Advanced → Custom CSS on an element for the first time, LHAI stamps it with a unique data-lhai-el attribute (e.g., data-lhai-el="el-a7c31"). Every selector token you write in the CSS box gets rewritten to [data-lhai-el="el-a7c31"], so rules scope automatically. You can't accidentally leak styles into other elements.

Custom CSS is stored inside a single hidden <style id="lhai-custom-css"> tag inside the page. It's plain CSS — no preprocessor, no post-processing — so it ships identically to the public site.

Database tables

LHAI installs one custom table; everything else lives in standard WordPress tables (wp_posts, wp_postmeta, wp_options, wp_usermeta).

{prefix}lhai_leads

CREATE TABLE wp_lhai_leads (
    id           BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    page_id      BIGINT UNSIGNED NOT NULL DEFAULT 0,
    page_title   VARCHAR(255)    NOT NULL DEFAULT '',
    form_data    LONGTEXT        NOT NULL,
    submitted_at DATETIME        NOT NULL DEFAULT CURRENT_TIMESTAMP,
    ip_address   VARCHAR(64)     NOT NULL DEFAULT '',
    user_agent   VARCHAR(500)    NOT NULL DEFAULT '',
    status       VARCHAR(20)     NOT NULL DEFAULT 'new',
    KEY page_id (page_id),
    KEY submitted_at (submitted_at),
    KEY status (status)
);

Installed on activation via dbDelta. The lhai_forms_db_version option tracks the schema version so future migrations can upgrade in place.

WordPress options used

OptionStores
lhai_license_keyYour license key (string)
lhai_license_statusLast-known status (active/expired/invalid)
lhai_api_modecloud or byok
lhai_claude_api_keyBYOK Claude key (Enterprise only)
lhai_gemini_api_keyBYOK Gemini key (Enterprise only)
lhai_claude_modelModel ID override
lhai_gemini_modelModel ID override
lhai_credit_planCurrent plan slug
lhai_credit_balanceLocal cache of remaining credits
lhai_forms_db_versionLeads table schema version
lhai_welcome_banner_dismissed'1' after the Dashboard welcome banner is closed

User meta used

Meta keyStores
lhai_onboarding_done'1' once the user has completed or dismissed the onboarding tour

Post meta used

Meta keyStores
_lhai_generated'1' on any page created via LHAI. Drives the Gutenberg overlay, the admin-bar button, and the front-end form runtime.

Useful constants

ConstantPurpose
LHAI_VERSIONCurrent plugin version, e.g. '1.0.29'
LHAI_PLUGIN_DIRAbsolute path to the plugin directory
LHAI_PLUGIN_URLAbsolute URL to the plugin directory
LHAI_DEV_MODEWhen true, unlocks the plan-switcher and manual credit-adjustment UI. Never enable in production.

Theme & plugin coexistence

LHAI pages are plain WordPress posts. They inherit your theme's header / footer / wrapper; only the main content area is LHAI-authored HTML. That means:

AJAX endpoints

ActionAuthPurpose
lhai_generateAdminBuild / edit a page (streaming)
lhai_generate_imageAdminSingle image generation
lhai_save_pageAdminFirst publish — creates a post
lhai_update_pageAdminSilent re-publish — updates an existing post
lhai_get_pagesAdminList recent pages
lhai_form_submitPublic + AdminForm submission handler (nonce: lhai_form_nonce)
lhai_leads_listAdminPaginated leads fetch
lhai_leads_bulkAdminBulk status change / delete
lhai_leads_exportAdminCSV export (redirect, not JSON)