# meta-writer: reviewed SEO titles and descriptions for posts

[meta-writer](https://github.com/IndianOpinion/meta-writer) is a WordPress plugin that drafts an SEO title and a meta description for each post from the post's own text, and holds them as suggestions until an editor accepts them. It is for operators with an archive too large to describe by hand. Licence MIT. Version v0.1.0, released 18 November 2026.

It was written from scratch from an idea, as one of the utilities described on the [engineering blog](https://indianopinion.org/blog/). It has not run on a live site.

## The problem

Search results show a title and a short description for every page. When a post has no description of its own, the SEO plugin falls back to the first words of the body. Those are often a dateline, an image caption, a shortcode remnant or a sentence cut in half. When the title field is empty, the post title is used, which may be too long or too vague.

Writing both fields by hand works for ten posts and fails for an archive of thousands. A single template sentence repeated across many pages reads as duplicate, thin content. Without a tool, an operator leaves the fields empty, writes a one-off script that overwrites manual values, or pastes model output into the database with no length check and no review. Pages with an empty body, such as template-driven pages, have nothing to generate from at all.

## What it does

- Selects posts of chosen types and statuses and drafts a title and a description for each, within character limits.

- Holds every result as a suggestion that an editor accepts, edits or rejects.

- Writes an accepted value only into an empty field, through the WordPress meta API, into the keys your SEO plugin already reads.

- Runs over the whole archive from WP-CLI, as a dry run first.

- Reverts a write while the field still holds exactly what the plugin wrote.

## How it works

Runner pages through posts with an ID cursor, never an offset, and hands each to Generator. Input reads the title, manual excerpt and body. Shortcodes are stripped by pattern and never run, and the body is cut to a budget at a sentence or word. Nothing else is sent: no author, comments or custom fields.

The call goes through [llm-json-php](https://github.com/IndianOpinion/llm-json-php) with a strict two-property JSON schema, or through a callable your site supplies on the meta_writer_caller filter. Validator normalises both strings, measures them in characters a reader sees and shortens at a sentence or word when too long. A string that is too short, empty, identical to the title or in the wrong script gets one more call with a note saying what was wrong, then fails. Flags such as trimmed, duplicate and unsupported_detail tell the reviewer where to look but never reject.

The targets are adapters. The README names the SEO plugins it writes to: Yoast SEO, Rank Math, SEOPress and All in One SEO (experimental), plus the plugin's own fallback fields when none is active. Each adapter writes only the post meta keys that plugin documents, and never another plugin's tables.

Provenance records each write with the value, a SHA-256, the previous value, the user and the time. A field counts as the plugin's own only while it is byte-equal to that record. One character changed by a person makes it theirs for good.

wp meta-writer generate --limit=20 # dry run, nothing called or written
wp meta-writer generate --limit=20 --run # spend calls, within the daily cap

Suggestions live in a {prefix}meta_writer_suggestions table. Rejected, failed, superseded and stale rows are purged after 90 days.

## Guard rails

- A dry run is the default. Without --run (or the confirmation after the admin dry run) nothing is called or written.

- The gate runs in order: kill switch, today's cap, the optional spend meter, then an atomic database increment of the counter. Any doubt means no call. The daily cap defaults to 200 model calls.

- The kill switch can be set on the settings screen, by wp meta-writer kill on, or by the constant META_WRITER_DISABLED, which the screen cannot undo. Review still works.

- Accept re-reads each target just before writing. A field someone filled meanwhile is left alone and the suggestion is marked superseded. There is no force flag.

- Posts that are password protected, opted out, already filled or already pending are skipped with a reason code. Posts under 40 words are skipped as too little content, so no filler is invented.

- The REST routes need authentication, and there is no bulk generation over REST.

- A custom base URL must be https, except for localhost, so a key never travels in clear.

## What review changed

An independent review of the build PR fixed these before the merge.

- The spend-meter integration used the wrong protocol. A failed call was released, which the contract reserves for calls never made. Every attempt that reaches the caller is now recorded, and unknown reason codes, malformed answers and thrown errors are denials.

- The gen-queue handler listened on an action that gen-queue never fires, so queued jobs would never have run. It now registers a job type on the right hook.

- On the review screen, a row's Accept button followed the bulk select, so pressing Accept with "Reject selected" chosen rejected the row.

- The stored API key is now blanked on every save while the constant is set, and a generic base URL must be https.

The review also fixed the post box, where an accept result was stored and never shown.

## Limits and what is next

- Length is in characters, not pixel width, so a wide-letter title may still be cut by a search engine.

- Only posts of chosen types. Category, tag and author archive descriptions are on the roadmap.

- No block editor sidebar panel. The edit screen box is a classic meta box.

- The adapters have not been tested against live installs of each SEO plugin. They write the keys those plugins document, and a mismatch should be reported.

- The wrong-script check covers thirteen script families. Other languages are not checked.

No issues are open on the repo. Test status: this is v0.1.0. 78 PHPUnit tests with 548 assertions pass on PHP 8.3, including four database tests against a throwaway MySQL 8.0, with PHPStan level 8 and phpcs clean. WordPress and model calls are tested against stubs and mocks. CI has not yet run on GitHub, and it has no production mileage.

## Install

It needs PHP 8.1 or later with mbstring, and WordPress 6.4 or later. The model library is on GitHub, not Packagist, so add both as VCS repositories, or use the release zip, which bundles it.

{
"repositories": [
{"type": "vcs", "url": "https://github.com/IndianOpinion/llm-json-php"},
{"type": "vcs", "url": "https://github.com/IndianOpinion/meta-writer"}
],
"require": {"indianopinion/meta-writer": "^0.1"}
}

[All 47 utilities](https://indianopinion.org/blog/open-source/) · [meta-writer on GitHub](https://github.com/IndianOpinion/meta-writer)

Canonical: https://indianopinion.org/blog/open-source/meta-writer/

AI disclosure: Every summary and comment here is written by AI and published automatically, without a person reviewing each article. We do no original reporting. How this works: https://indianopinion.org/ai-use-policy/
