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.
| Attribute | On | Purpose |
|---|---|---|
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-el | Any element | Stable 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
| Option | Stores |
|---|---|
lhai_license_key | Your license key (string) |
lhai_license_status | Last-known status (active/expired/invalid) |
lhai_api_mode | cloud or byok |
lhai_claude_api_key | BYOK Claude key (Enterprise only) |
lhai_gemini_api_key | BYOK Gemini key (Enterprise only) |
lhai_claude_model | Model ID override |
lhai_gemini_model | Model ID override |
lhai_credit_plan | Current plan slug |
lhai_credit_balance | Local cache of remaining credits |
lhai_forms_db_version | Leads table schema version |
lhai_welcome_banner_dismissed | '1' after the Dashboard welcome banner is closed |
User meta used
| Meta key | Stores |
|---|---|
lhai_onboarding_done | '1' once the user has completed or dismissed the onboarding tour |
Post meta used
| Meta key | Stores |
|---|---|
_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
| Constant | Purpose |
|---|---|
LHAI_VERSION | Current plugin version, e.g. '1.0.29' |
LHAI_PLUGIN_DIR | Absolute path to the plugin directory |
LHAI_PLUGIN_URL | Absolute URL to the plugin directory |
LHAI_DEV_MODE | When 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:
- Your theme's global styles still apply (typography baseline, links, buttons).
- SEO plugins (Yoast, RankMath) see a normal post and process it normally.
- Cache plugins (WP Rocket, LiteSpeed) work normally — LHAI pages aren't dynamic.
- Translation plugins (WPML, Polylang) can translate LHAI pages like any other page.
AJAX endpoints
| Action | Auth | Purpose |
|---|---|---|
lhai_generate | Admin | Build / edit a page (streaming) |
lhai_generate_image | Admin | Single image generation |
lhai_save_page | Admin | First publish — creates a post |
lhai_update_page | Admin | Silent re-publish — updates an existing post |
lhai_get_pages | Admin | List recent pages |
lhai_form_submit | Public + Admin | Form submission handler (nonce: lhai_form_nonce) |
lhai_leads_list | Admin | Paginated leads fetch |
lhai_leads_bulk | Admin | Bulk status change / delete |
lhai_leads_export | Admin | CSV export (redirect, not JSON) |