Skip to content

Write alt text, internal links and robots.txt fixes - #3

Open
Alt-Charlie wants to merge 8 commits into
dev-9669from
dev-9477
Open

Alt-Charlie wants to merge 8 commits into
dev-9669from
dev-9477

Conversation

@Alt-Charlie

@Alt-Charlie Alt-Charlie commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Writes image alt text to the media library and to the page's own copy (cover blocks included), links the first mention of another page in a page's content or ACF editor fields, and fixes robots.txt as a file at the web root or through the robots_txt filter. From review: the web root is found from ABSPATH when WordPress sits in its own folder, a link in an ACF group or flexible content field is no longer reported as failed, a mention stored with entities or straight quotes is found, and alt text in the media library clears the whole page cache.

https://linear.app/alt-design/issue/DEV-9477

Testing: 271 tests pass locally on PHP 8.4 and 8.1. The tests install free ACF, so ACF PRO's repeater and flexible content storage is not exercised.
Risk: once approved, these change post content, attachment alt text and robots.txt on a live site. Content edits leave a revision; an earlier robots.txt is not kept.
How to revert: revert the merge commit. Values already written stay until reverted from Altimiser. Based on #2.

Alt text goes to the media library and the page's own copy, wherever each
still holds what the scan saw, and cover blocks keep their attribute in step.
Links go into the first mention in the page's content or an ACF editor field,
saved without kses so embeds and scripts survive, and come off again on a
revert. robots.txt is created or given a sitemap line, through the robots_txt
filter where WordPress prints it. Page builder pages are left alone.
… a folder of its own

get_home_path() reads the folder from the script being run, which during a REST request is the root index.php, so on a site with WordPress in its own folder it answered / and every robots.txt write failed. Where the site address and ABSPATH do not agree the change is skipped rather than guessed at.
update_field() answers false for a group or flexible content field whose sub fields were written, because the parent's own stored value is unchanged, so a link written there was reported as write_failed.
The scan reads the page as printed, so Terms & Conditions stored as Terms & Conditions, or an apostrophe typed straight and printed curly, came back as mention_not_found, and skipping withdrew the approval.
The library's alt text shows on every page that prints the image, and only the scanned page was purged, so the others kept the old wording until their cache expired.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant