Skip to content

Fix schema-audit CLI checking no pages - #237

Merged
jasperf merged 3 commits into
mainfrom
fix/schema-audit-cli-sitemap
Sep 19, 2026
Merged

jasperf merged 3 commits into
mainfrom
fix/schema-audit-cli-sitemap

Conversation

@jasperf

@jasperf jasperf commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Version: 5.24.3

This release, 5.24.3, fixes two defects that made schema auditing report wrong results on real WordPress sites, one in the wp-ops schema-audit CLI script and one in the schema_audit MCP tool. The CLI script added paths that start with / to a site URL that already ended in a slash, so every request went to //path/. Sites answered with a 301, every page was skipped, and on imagewize.com the script checked 0 of 11 pages. The script has been rebuilt to match the 5.24.2 MCP fix: it now takes its page list from the site's sitemap, lists non-200 URLs separately, and fetches each page once. The MCP tool read only the top-level @type, so the Organization, WebSite and BreadcrumbList nodes that SEO plugins nest in an @graph array went uncounted. It now walks the whole JSON-LD tree.

Schema Audit CLI Rebuild:

  • Fixed the double-slash URL bug that led the script to skip every page, homepage included, as "not found."
  • Pages now come from the site's sitemap, trying wp-sitemap.xml, then sitemap_index.xml, then sitemap.xml. From a sitemap index it reads only the page sitemaps. The homepage is always checked first, and the common paths are used only when a site has no sitemap. The output says when that fallback is used.
  • Added a --max-pages flag (default 25) to cap how many sitemap pages are checked. The report says when the cap cuts the list short.
  • URLs that don't return 200 now appear in a separate "NOT CHECKED" section with their status code and redirect target, and are left out of the totals.
  • Fixed the "PAGES NEEDING SCHEMA MARKUP" list, which was always empty: the grep -c ... || echo "0" fallback printed 0 twice and broke the numeric test. The list is now built during the audit.
  • Each page is now fetched once instead of up to six times, and --pages accepts full URLs as well as paths.
  • JSON-LD blocks that span several lines or carry extra attributes are now parsed, and Person is now a detected type. This parsing needs perl, which comes with macOS and standard Linux servers.

MCP schema_audit Tool:

  • checkSchemaTypes in mcp-server/src/tools/schemaAudit.ts now collects every @type value anywhere in the JSON-LD tree. This catches the nodes that Yoast, Rank Math and The SEO Framework nest inside @graph.
  • Fixed the text fallback for JSON-LD that doesn't parse, which never matched because it lowercased the schema but not the type it searched for. It now uses a regex match that also covers @type arrays.

Catalog and Documentation:

  • Updated the wp-cli/seo/schema-audit entry in go/internal/catalog/catalog.json with the new description, the perl requirement, the new --max-pages argument, and the updated --pages wording.
  • Rewrote the schema audit section of wp-cli/seo/README.md to cover sitemap discovery, the page cap, the non-200 handling and the full list of detected types. Added usage examples for --max-pages, --pages and --output.
  • Added the 5.24.3 entry to CHANGELOG.md.

Files Changed:

The script appended paths that start with a slash to a site URL it had
already given a trailing slash, so every request went to //path/. Sites
answer that with a 301, and the audit skipped every page as not found:
on imagewize.com it checked nothing and reported 0 of 11.

Rebuilt along the lines of the schema_audit MCP fix: pages come from
the site's sitemap (new --max-pages, default 25), with the common paths
only as a fallback. Each page is fetched once instead of up to six
times, non-200 URLs are listed separately with their redirect target,
and --pages accepts full URLs.

Also fixes the pages-needing-schema list, which was always empty: the
grep -c fallback printed 0 twice and broke the numeric test. JSON-LD
spanning several lines is now read, and Person is detected.
Only the top-level type field of each JSON-LD block was read, so the
Organization, WebSite and BreadcrumbList nodes SEO plugins nest in a
graph array went uncounted. The imagewize.com homepage reported none of
the tracked types. The text fallback for unparseable JSON-LD also never
matched, since it lowercased the schema but not the type it searched
for.
@jasperf
jasperf merged commit 319cde6 into main Sep 19, 2026
1 check passed
@jasperf
jasperf deleted the fix/schema-audit-cli-sitemap branch September 19, 2026 03:49
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