Engineering Blog
Checking the change before writing back to WordPress
Short answer
When a site owner chooses to apply a suggestion, we retrieve the current WordPress content and check where the edit belongs. We write when the target is clear and offer the wording for copying when it needs a manual edit.
Constrain the connection and target
We store the WordPress application password encrypted and use it to call the REST API over HTTPS on the registered host. At apply time, we check the subscription state and whether the proposal page belongs to that site.
We match the URL returned by WordPress for posts and pages. For the home page, we read WordPress’s front-page setting.
Plan from the current value
For titles and descriptions, the original text must match a current value. For an edit to post content, we parse HTML, look for one eligible match in a visible text node, and compare the count of non-text nodes before and after the change.
Content writes also require permission to preserve HTML. If the public HTML has a recognized page-builder marker or the original text appears in two eligible places, we offer the wording for the site owner to copy into their editor.
Verify the response and limit undo
We record the planned change before writing and compare the returned saved value with the expected value. If they differ, we attempt to restore the previous value and report failure; the restore itself can fail. That restore also cannot fully prevent overwriting an intervening edit.
Undo compares a hash of the entire target field and will not overwrite it if it has changed since the write. An edit between reading and writing can still race with this process. Content applied manually from a copy is outside this undo path.
Trace a fictional body edit
Suppose the stored body of a fictional repair page is “<p>We repair bicycles.</p>”. The proposed original is “We repair bicycles.” and the replacement is “We service bicycles.” If the URL matches, the original occurs in one eligible visible text node and the other conditions pass, the system plans that replacement. A plan is not a guarantee that the write succeeds.
If the original sentence appears twice, the system cannot choose between them and offers the text for manual copying. A changed current value, an unreadable supported SEO description, or missing permission to preserve HTML can also prevent automatic application. Compare the proposal with the WordPress editor and choose the intended location.
Check the page and recover deliberately
Before applying, check the URL and both versions. After applying, open the public page and inspect the edited sentence and surrounding layout. A cache can delay what visitors see, so check the saved value and public display separately.
If undo reports a changed value or fails, do not blindly overwrite subsequent edits. Compare the current WordPress field with available revisions and decide with the site maintainer what to restore. Automatic restoration can itself fail; changes pasted manually are outside this service’s undo path.