Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/carlodaniele/ai-content-builder/archive/refs/heads/main.zipAI Content Builder is a lightweight WordPress 7.0 plugin that transforms uploaded audio voice notes into structured post content directly inside the Block Editor. It uses the native WordPress AI Client to transcribe audio and generate clean editorial output without hardcoded provider credentials.
Key Features
- Native Gutenberg Sidebar integration through WordPress core editor components.
- Provider-agnostic AI integration via
wp_ai_client_prompt(), relying on active providers configured in Settings > Connectors. - Two-step AI processing pipeline:
- Audio transcription from uploaded media.
- Structured post composition using JSON schema output (
title+sections).
- Block-first editor insertion:
- Sets AI title as post title (optional via sidebar toggle).
- Inserts native Gutenberg blocks (
core/heading,core/paragraph,core/list). - Supports optional
bullet_pointsper section.
- Robust fallback parser:
- Converts plain text / HTML-like output (
<br>,<p>,- bullets) into structured blocks. - Avoids the “single giant paragraph block” issue when providers return unstructured content.
- Converts plain text / HTML-like output (
- Hardened AI networking:
- Request timeout extended to 300 seconds for known AI hosts.
- Additional cURL tuning for long-running generation requests.
- Scoped only to known AI provider hostnames to avoid affecting unrelated WordPress requests.
- Automatic cache busting for editor script via file modification time.
How It Works (Under the Hood)
The plugin runs a focused two-step REST flow when a user clicks Generate Content in the sidebar:
-
Transcription Step
- The selected audio attachment ID is sent from the Block Editor sidebar to a custom REST endpoint.
- The server validates the attachment, reads the audio file, and passes it to
wp_ai_client_prompt()withwith_file(). - The AI provider returns plain transcript text.
-
Schema Formatting Step
- The transcript is sent in a second AI prompt.
- The response is constrained using
as_json_response()with a schema that requests:titlesections[]withheading,level,paragraphs[], optionalbullet_points[]
- JSON is parsed and normalized server-side (including compatibility handling for legacy shapes).
-
Editor Injection
- Primary path:
- Sets post title from returned
title(if the sidebar toggle is enabled). - Converts
sectionsinto native Gutenberg blocks:- Heading ->
core/heading(H2/H3) - Paragraphs ->
core/paragraph - Bullet points ->
core/list
- Heading ->
- Sets post title from returned
- Fallback path:
- If structured sections are missing, plain text is parsed into headings/paragraphs/lists.
- Single paragraph insertion is used only as last resort.
- Primary path:
Prerequisites & Requirements
- WordPress 7.0+
- PHP 8.0+
- At least one active AI provider configured in Settings > Connectors
Installation
- Create the plugin folder:
/wp-content/plugins/ai-content-builder/
- Copy these files into the folder:
ai-content-builder.phpeditor.js
- In WordPress Admin, go to Plugins.
- Activate AI Content Builder.
- Go to Settings > Connectors and ensure an AI provider is configured and active.
How to Use
- Open a post or page in the WordPress Block Editor.
- Open the AI Content Builder sidebar from the editor menu.
- Click Upload audio note and select an audio file.
- Choose whether to replace the current post title with the AI-generated title.
- Click Generate Content.
- Wait for processing to complete.
- Review generated title and structured content blocks in the editor.
Technical Notes
- REST endpoint:
POST /ai-content-builder/v1/generate - Capability check:
current_user_can( 'edit_posts' ) - AI availability checks:
wp_ai_client_prompt()function existswp_supports_ai()(when available)
- Structured response contract on success:
title(string)sections(array)content(plain-text fallback)transcript(raw transcript)
- Section object shape used by the editor:
heading(string)level(integer; normalized server-side to H2/H3)paragraphs(string array)bullet_points(optional string array)
- AI-specific timeout host allowlist includes:
generativelanguage.googleapis.comapi.openai.comapi.anthropic.com
- AI timeout defaults for allowlisted hosts:
- HTTP timeout: 300 seconds
- cURL connect timeout: 30 seconds
- cURL low-speed tolerance for long model processing windows
Example Response Payload
Below is a representative success payload returned by POST /ai-content-builder/v1/generate:
{
"title": "A Rest Day in Marrakech",
"sections": [
{
"heading": "A Day Off for Seven Riders",
"level": 2,
"paragraphs": [
"On April 24, the group parked their bikes for a full day of rest in Marrakech.",
"The break gave everyone time to explore the city on foot and recharge."
],
"bullet_points": []
},
{
"heading": "The Medina and Jemaa el-Fnaa",
"level": 2,
"paragraphs": [
"Walking through the Medina, we discovered local food, vibrant colors, and traditional crafts."
],
"bullet_points": [
"Try Moroccan and Berber dishes",
"Shop in the souks",
"Meet local residents"
]
}
],
"content": "Fallback plain text...",
"transcript": "Full transcript..."
}
Payload to Gutenberg Mapping
title: mapped to post title in the editor viacore/editordispatch (if title toggle is enabled).sections[].heading: mapped tocore/heading.level = 2-> H2level = 3-> H3
sections[].paragraphs[]: each entry mapped to onecore/paragraphblock.sections[].bullet_points[]: mapped to onecore/listblock with bullet items.content: used only as fallback whensectionsare missing/invalid.- Fallback parser attempts to split text into headings, paragraphs, and lists.
- Single
core/paragraphinsertion is the last-resort path.
Troubleshooting
-
Output still appears as one paragraph block
- Hard-refresh the editor page (or reopen the post editor tab) to ensure latest script is loaded.
- Confirm connector/provider is returning structured JSON and not only plain text.
-
Provider timeout / cURL error 28
- The plugin already applies extended timeout and cURL options for allowlisted AI hosts.
- If failures continue, try with a shorter audio file or lower model load periods.
License
GPL-2.0-or-later