AI Optimize (per-sentence rewrite)
Editor workflow that proposes per-sentence rewrites with a before/after diff. Each suggestion is server-verified against your current (unsaved) editor content; accepting one updates only that sentence in the editor — never auto-saves the post.
Where to find it
Open a post in the block editor and look at the ProRank sidebar — the new AI Optimize (per-sentence) panel sits next to AI Assistant. You'll need an AI provider configured under ProRank SEO → AI Tools first (the same provider that powers Ask / Summarize / Generate).
Workflow
- Pick a tone (neutral / concise / friendly / professional / persuasive) and click Analyze. ProRank serializes the editor's current blocks, sends them with your tone choice, and the provider returns one rewrite per sentence.
- Each suggestion shows an inline diff (red = removed, green = added) plus the reason / category the AI provided. Click Accept on a row to apply just that sentence, Reject to skip it, or Regenerate to re-run Analyze with the current editor state.
- Accept all visible applies every pending row in order, stopping on the first conflict.
- ProRank mutates the matching block's attribute in the editor only. No save happens automatically— you still click Update to publish.
What gets rewritten — and what doesn't
AI Optimize touches only normal editable text in paragraph and list-item blocks. It deliberately skips:
- Headings (
core/heading) — never auto-rewritten. - Code / pre / script / style spans — contents are stripped before reaching the AI and never targetable on apply.
- Anchor text (
<a>) — link text is treated as a protected span. A duplicate sentence inside a link cannot be rewritten even if its text matches a target outside the link. - Shortcodes — both paired and self-closing forms.
- Reusable / synced / template blocks — refused to walk in.
- Sentences that cross inline markup (e.g. mid-sentence
<strong>) — surfaced as "skipped" rather than emitted as an unapplyable suggestion.
Safety + conflict handling
Server-verified apply
Each Accept call sends the editor's current (unsaved) content. The server re-extracts sentences from that content and refuses if your sentence is no longer there — you'll see a per-row 'changed since suggested' notice instead of an overwrite.
Protected-span safe targeting
The server returns a verified character offset + length that's guaranteed to sit outside any anchor / shortcode / code span. The client splices by that offset (never a plain string-replace), so a duplicate sentence inside a link is never rewritten.
Duplicate-safe
Identical sentences in the same paragraph get distinct IDs and stable targeting. Accepting the second duplicate first updates only the second; accepting the first later still works.
BYOK + per-post permission
Every route checks edit_post on the current post. Suggestion sets bind to your user_id, so another logged-in editor cannot apply your token. No managed proxy, no shared credits.
Session history
The panel shows a compact generated / accepted / rejected / conflict counter for your current editor session. History is stored in user meta with metadata only — never the post body — and is capped to the last 20 events.
Limits
- Up to 30 sentences per Analyze run.
- Suggestion sets live for 10 minutes (single-use applies per sentence).
- Same provider, model, and quota as the rest of your AI Tools surface — Ask, Summarize, Generate, and AI Optimize share one BYOK bucket.