Describe a topic, get a structured draft back
Set up an AI post generator WordPress editors can trust with structure: a target word count, real H2/H3 headings, lists and an SEO description — generated as a draft, never published automatically, from a description you write in one modal.
- Section-by-section structure keeps word count within ±10%.
- Enforced H2/H3 headings, lists and bold key terms — every time.
- Always saved as a draft, never published without review.
- Syncs title, description and keyphrase to SEO Meta and Yoast.
AI post generator WordPress: what does the module actually build?
This is what an AI post generator WordPress editors get with TheOneWP: an "Add with AI" button next to "Add New" in the posts list, plus the same generation available inside the editor itself, opens a modal where you describe the topic and a target word count. TOWP_Ai_Post_Generator turns that into a section-by-section structure, sends it to OpenAI or Gemini with a system prompt that mandates H2/H3 headings, lists and bold key terms, and returns a title, HTML content, excerpt, meta description and focus keyphrase as one JSON object. The result is always saved as a draft — never published automatically — and its SEO fields sync to the SEO Meta module and Yoast SEO when either is active.
A first draft is the hardest part to start
Getting from "we should write about this" to an actual structured draft — with headings, a real word count, and an SEO description already in place — is often the step that stalls content plans.
Generic AI output rarely matches a target length
Asking a chatbot for "about 600 words" commonly returns something noticeably shorter or longer, with no structural plan behind the number.
A wall of text with no headings is not a usable draft
Content without H2/H3 structure, lists, or emphasis still needs a full formatting pass before it is ready for an editor to work with.
A plan first, then the writing
The module calculates a section structure before generating a single word, then checks and corrects the result against it.
Structure calculated first
Intro, a variable number of H2 sections, and conclusion are sized in words before generation starts — not guessed afterward.
Checked and corrected automatically
A result outside ±10% of the target word count triggers one automatic rewrite with an explicit shorter-or-longer instruction.
A draft, not a publish
Every generated post lands as a draft — review and editing stay a required step, not an afterthought.
The complete AI post generator WordPress feature set
Every capability below is present in the class, its AJAX handlers, or the section-structure engine.
Section-by-section word budgeting
15% intro, 15% conclusion, and 2-8 H2 sections of roughly 150 words each, calculated from the target before any content is written.
List table and editor, same engine
"Add with AI" creates a new draft from the posts list; the same generator also fills an already-open editor without a second post.
Enforced HTML formatting
H2 sections, at least 2 H3 sub-headings, at least 2 lists, and bold key terms are mandatory rules in the system prompt, not a hope.
SEO fields written on creation
Meta description, title, Open Graph fields and keyphrase all save to the right module automatically, based on what is active.
Dynamic token budget and timeout
Both scale with the requested word count, so a short post and a 2,000-word article each get a request sized — and timed out — appropriately.
Per-request model override
A different model can be chosen at generation time, validated against the configured provider so it never fires against the wrong API key.
Generate an AI post generator WordPress draft in four steps
A specific description produces a more useful structure than a one-line topic.
Click "Add with AI"
Available next to "Add New" in the list table for every enabled post type, and inside the editor itself.
Describe the topic and set a word count
A specific, detailed description gives the section structure something real to work with.
Let it generate — and retry if needed
The module checks the word count itself and retries once automatically if the first result misses the target.
Review the draft before publishing
Check structure, facts and tone — the post is a draft specifically so this step still happens.
Where a structured first draft saves real time
The module fits content work where the plan and the first pass are the slow part.
Editorial calendars with many topics to cover
Turn a list of planned topics into structured drafts quickly, leaving the editing time for polish, not a blank page.
Content clusters needing consistent structure
The same H2/H3/list requirements apply to every generated piece, keeping a series of articles structurally consistent.
Agencies drafting for multiple clients
Generate a first draft per client brief, in the client's own language, without repeating the same manual setup each time.
A draft that respects both length and structure
Every design choice in the verified code favors a genuinely usable draft over a wall of unstructured text.
Sized to the request, not a fixed budget
The verified implementation scales its resource use with what is actually being asked for.
Token budget scales with word count
Roughly 4 tokens per requested word plus a 1,000-token fixed overhead, rounded up to the nearest 1,000, with a 3,000-token floor.
Timeout scales with the token budget
About one second per 30 tokens, kept between 120 and 300 seconds — long enough for a large article, not indefinite.
A lower rate limit, on purpose
Defaulting to 5 requests per minute instead of the higher limits used elsewhere, matching how much heavier a full-article request is.
User input handled carefully, not just escaped
The code treats the topic description as untrusted text at every stage, including how it is inserted into the prompt itself.
edit_posts capability and a verified nonce
Both generation endpoints require this capability and check the nonce before doing anything else.
String concatenation instead of sprintf() for the prompt
The topic description is inserted with direct concatenation rather than sprintf(), specifically because a % character in the description would otherwise be misread as a format placeholder.
Post type validated against the configured list
A request naming a post type outside the enabled list, or one that does not exist, is rejected before any AI call is made.
Model override validated against the configured provider
Switching models at generation time only works if the requested model belongs to the same provider already configured — never a silent provider switch.
Writes into the fields your SEO tools already read
The supplied code checks for and writes to specific, named integrations rather than assuming its own fields are the only ones that matter. No compatibility claim beyond the verified implementation is assumed.
SEO Meta module
When active, the generated title, description, Open Graph title/description and keyphrase all save directly to SEO Meta's own fields.
Yoast SEO
Detected via WPSEO_VERSION; the generated meta description is written to Yoast's own field automatically.
Same provider list as the other AI modules
The identical 12-model OpenAI/Gemini list, encryption helper and retry pattern used by AI Alt Text Generator and AI Meta Description Generator.
TheOneWP versus common alternatives
Compare a real AI post generator WordPress implementation with typical AI-writing plugins or a general chatbot pasted into the editor.
| Capability | TheOneWP AI Post Generator | Other common solutions |
|---|---|---|
| Word count accuracy | Section-budgeted, checked and retried automatically | Often noticeably off from the requested length |
| Structure | Mandatory H2/H3, lists and emphasis, every time | Varies; frequently a single block of prose |
| Publish safety | Always saved as a draft | Some tools can auto-publish generated content |
| SEO field sync | Title, description and keyphrase written automatically | Usually requires copying fields over manually |
| Where it works | Posts list and inside the editor, same engine | Often one entry point only |
| Administration | One TheOneWP settings panel, your own API key | May require a separate plugin and its own account |
Get drafts worth editing, not rewriting
A few habits make the generated draft a genuine head start.
Write a specific description, not a title-length prompt
A few sentences of real detail give the section structure and the model something concrete to work from.
Pick a word count that matches the actual topic
A narrow topic stretched to a high word count tends to repeat itself — match the target to how much the topic supports.
Always review before publishing
Fact-check specifics, adjust tone, and confirm the structure fits the site's actual editorial standards.
Set the language deliberately for multilingual sites
Override the default language per generation when writing for an audience the site default does not match.
Avoid assumptions the code does not support
The module has a defined, verified scope — a few assumptions outside it cause confusion.
Expecting it to publish automatically
Every generated post is a draft by design — treating it as ready to go live skips the review step it was built to require.
Expecting an exact word count every time
The target is enforced within ±10% after one automatic retry — not a guaranteed exact figure on the first attempt.
Expecting it to work without an API key
Like the other AI modules, generation fails immediately with a clear error if no key is configured — there is no built-in AI service.
AI Post Generator FAQ
These answers come directly from the verified class and its AJAX handlers.
Does it publish the post automatically?
No. wp_insert_post() always saves with post_status set to draft — every generated post waits for a human to review and publish it, regardless of where the generation was triggered from.
How does it hit a specific word count reliably?
It builds a section-by-section structure first — a fixed 15% for the introduction, 15% for the conclusion, and the rest split across 2 to 8 H2 sections of roughly 150 words each — and gives the model a word target per section, not just one total. If the result still lands outside ±10% of the target, it automatically retries once with an explicit "write shorter" or "write longer" instruction.
What HTML structure does the generated content actually have?
The system prompt requires an <h2> per section, at least two <h3> sub-headings, at least two <ul> or <ol> lists, <p> paragraphs, and <strong> for key terms — enforced as mandatory rules, not a suggestion.
Can I use it from inside the post editor, or only the posts list?
Both. The list table's "Add with AI" button creates a new draft directly; the same generation engine also runs from inside the editor itself, filling the current post's fields without inserting a second one.
Where do the SEO fields it generates end up?
The meta description always saves to _towp_meta_description, and to Yoast's own field if Yoast is active. If the SEO Meta module is active, the title, description, Open Graph title/description and keyphrase all save to SEO Meta's own fields too.
How is the request timeout calculated for a long article?
Dynamically: roughly one second per 30 tokens of budget, clamped between 120 and 300 seconds — so a short post and a long one each get a timeout proportional to how much they actually need.
Can I change the topic and get something unrelated back?
The system prompt explicitly instructs the model to write exclusively about the given topic and never invent a different one, and the user prompt repeats that the title and all content must be 100% about it.
Is there a limit on how many posts I can generate per minute?
Yes, a configurable per-user rate limit, defaulting to 5 requests per minute — deliberately lower than the other AI modules, since generating a full article is a heavier request than a short piece of text.
Stop staring at a blank draft.Describe it, and start editing instead.
Use an AI post generator WordPress editors can trust with structure: a real word-count target, mandatory headings and lists, and a draft that always waits for your review.

