Skip to content

Theme taxonomies & search integration fixes

Last updated on June 8, 2026

This week was one of the deepest dives yet — most of the time went into untangling how themes behave between taxonomy pages and search results. The goal was to unify templates while keeping behavior logical:

  • Theme pages should only show CPTs explicitly tagged with that theme.
  • Search pages should show both CPTs and relevant themes, but without themes “acting like” searches themselves.

It turned into a bigger mess than expected, since the shared templates were written to always expect a $search_term, which caused taxonomy pages to behave like search pages.

Changes completed

  • Recovered the last known working version of taxonomy-theme.php that used shared templates — where taxonomy pages worked correctly but leaked some search‑like behavior (e.g., “man” pulling in unrelated artists). Saved this for future rework.
  • Identified that only the Artist CPT was misbehaving in taxonomy queries, likely due to its custom three‑tier categorization.
  • Confirmed taxonomy pages themselves are fine when using self‑contained queries — but that bypasses the shared template system. For now, sticking with the independent working version, returning to shared templates later once templates can distinguish between taxonomy and search contexts.
  • Investigated why themes still weren’t appearing in search results. Discovered that WP search ignores taxonomy terms, and Relevanssi needs explicit indexing plus a custom loop to surface associated terms. Planned a fix where search results will pull in posts via Relevanssi, then collect their associated themes and display them in the theme-list grid.
  • Cleaned up old artist‑specific query logic that was introducing partial matches and inconsistent behavior in both search and taxonomy contexts.

Next steps

  • Modify shared templates so they can branch: if called from taxonomy, use only tax_query; if called from search, include $search_term.
  • Adjust the Artist CPT template so its special taxonomy system doesn’t cause false positives.
  • Implement the planned Relevanssi + theme collector for search, so themes reliably appear when relevant to search terms.

Earlier work (carried over for coherency)

Featured In system refactor
Built a reusable show_featured_in_threads() helper that pulls Chapters + Fragments together in one unified grid. Migrated all CPTs except Artists, Songs, and People (Songs already had a custom version; Artists/People would be too cluttered).

Sidebar updates & CPT index fixes
Fixed the “No entries found” bug by restoring the original loop. Anchors for narrative threads/fragments now point to homepage anchors. CPT totals updated (1320 → 1330) since new taxonomies like theme are now counted. Sidebar snippet now shows last update date, thread/fragment counts, and total entries, with emojis for consistency.

Artist search bug
Debugged why Artists (e.g., Nirvana) weren’t appearing in search. Found an old special case merging “artist + rapper” queries — once removed, Artist CPTs flowed through the normal search path and now display correctly.

Reference CPT content handling
Standardized the_content() rendering across CPTs — it now always displays. ACF “description” is still shown when present, but no longer controls whether the_content() appears.

Themes structure
Established workflow where themes act as poetic hubs instead of dry dictionary entries. Added ACF image fields + theme-grid.php template for visual theme display (top 20 themes get the grid, rest show alphabetically). Confirmed themes don’t appear in search by default since they’re a taxonomy — planned direct query integration for search.