Skip to content

Write SEO title and description for category and tag archives - #26

Merged
mostafasoufi merged 2 commits into
mainfrom
term-seo
Oct 23, 2026
Merged

mostafasoufi merged 2 commits into
mainfrom
term-seo

Conversation

@mostafasoufi

Copy link
Copy Markdown
Member

Closes #25

What changes

  • Sync: category, tag, product category and other archive terms are sent after the posts as content items (id: "term:<taxonomy>:<term_id>", type: "term:<taxonomy>", term_id, taxonomy). Terms with no posts are left out, like unpublished posts. Post formats are left out.
  • Writes: a change can name term_id and taxonomy instead of post_id, for seo_title and seo_description.
    • Rank Math: rank_math_title / rank_math_description term meta.
    • Yoast SEO: wpseo_taxonomy_meta through WPSEO_Taxonomy_Meta::set_values(), with the term's other values passed back so they are kept, then Yoast's term indexable is rebuilt.
    • No SEO plugin: the description is the term description; a title is refused (not_supported).
    • Other SEO plugins: refused (not_supported).
    • Expected value checked like posts (changed_since_preview with current), archive URL purged from page caches, undo through the change log works.
  • Status: term_seo in can_write when the setup supports it, plus taxonomies (term counts).
  • Live changes: created, edited and deleted terms are pushed to /changes.
  • Version 0.1.24 with changelog. No release.

Tests

  • Unit: vendor/bin/phpunit, 114 tests pass (new tests/unit/TermSeoTest.php: none / Rank Math / Yoast / other plugin, expected check, undo, cache purge, paging, status, live changes).
  • Integration on a local WordPress: tests/integration/TermSeoTest.php passes without plugins and with Yoast SEO 28.5 loaded (MONORANKS_WP_PLUGINS=wordpress-seo/wp-seo.php), including the rebuilt Yoast indexable. Rank Math was not installed locally, so it is covered by unit tests only.

Terms of every archive taxonomy (category, post_tag, product_cat, product_tag and other public taxonomies with archive pages) are now sent with the content sync after the posts, as content items with id "term:<taxonomy>:<term_id>", term_id and taxonomy. Their SEO title and meta description come from Rank Math term meta, Yoast's wpseo_taxonomy_meta option, or, without an SEO plugin, the term description.

A change may now name term_id and taxonomy instead of post_id. The SEO title and meta description are written into Rank Math term meta, Yoast's taxonomy meta (through WPSEO_Taxonomy_Meta::set_values with the term's other values kept, then Yoast's indexable is rebuilt), or the term description when no SEO plugin is active. Titles without an SEO plugin and any other SEO plugin are refused with not_supported. The expected value is checked like posts, the archive URL is purged from page caches, and undo works through the change log.

Status reports "term_seo" in can_write and term counts per taxonomy. Created, edited and deleted terms are pushed as live changes.

Version 0.1.24 (no release).

Closes #25
@mostafasoufi
mostafasoufi merged commit c854818 into main Oct 23, 2026
11 checks passed
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.

Write SEO title and description for category and tag archives (term meta)

1 participant