1. Files and Structure #
Docs list the main AI Writer files:
aiWriter/aiWriter.php– core module.aiWriter/aiWriter-setting.php– admin settings.aiWriter/DavixImage/class-davix-image-controller.php– image endpoints for media helpers.assets/js/aiWriter.js– Gutenberg editor JS for the sidebar.assets/css/davix-chat.css– styling, reused with chat branding for consistency.
2. Pro Gating #
Docs:
- When Pro is not active:
aiWriter.phpreturns early.- No AI Writer submenu.
- No sidebar.
- Pro status is checked via:
my_fs()->can_use_premium_code()(Freemius integration).
3. REST API #
Docs specify:
- Namespace:
davix-ai-writer/v1 - Endpoint (example):
/generate - Uses the REST nonce
wp_restfor security.
Internal behavior:
aiWriter.jscalls the/generateendpoint with:- Current content or selected text.
- Global + per-post options (model, temperature, tone, tokens, etc.).
- The server:
- Validates nonce and permissions.
- Uses AI Writer settings from
davix_aiwriter_settings. - Uses overrides from
_davix_aiwriter_overrides. - Sends a request to the OpenAI API.
- Returns generated text to the editor.
4. Settings & Meta Storage #
Docs:
- Global settings:
- Stored in
davix_aiwriter_settings. - Include:
- Model
- Temperature
- Tone presets
- Token limits
- Roles allowed
- Media helper flags
- Stored in
- Per-post overrides:
- Stored in
_davix_aiwriter_overridesmeta.
- Stored in
These are localized to JS through:
enqueue_block_editor_assets(), which passes:restUrl(AI Writer endpoint URL).nonce(wp_rest).isPremiumflag.- Default settings + per-post overrides.
5. Script Enqueueing #
Docs say:
- Scripts are enqueued via
enqueue_block_editor_assets(). - This ensures:
aiWriter.jsis only loaded in the block editor.- Styles are applied inside the editor UI, not on the front-end.

