Skip to content

[6.x] Fix taxonomy index terms for multi-site and Blade - #15646

Merged
jasonvarga merged 4 commits into
6.xfrom
fix/taxonomy-index-terms-site-handle
Oct 15, 2026
Merged

jasonvarga merged 4 commits into
6.xfrom
fix/taxonomy-index-terms-site-handle

Conversation

@joshuablum

Copy link
Copy Markdown
Member

This PR fixes two problems with $terms on taxonomy index routes (e.g. /tags):

1. 500 on multisite with the Eloquent driver

Taxonomy::toResponse() passed the current Site object to where('site', ...). Stache casts it to a string when comparing, so it worked there. The Eloquent driver passes the value to Term::in(), though, so the Site object ended up being used as a localization array key:

Cannot access offset of type Statamic\Sites\Site in isset or empty
  • The taxonomy route now passes $site->handle(), like every other term query in core.
  • The CP terms listing gets the same change (Site::selected()->handle()). It didn't crash, but only because it re-localizes the terms afterwards.
  • Term::in() now accepts a Site instance and converts it to its handle, the same way Entry::locale() already does. This covers other code that passes a Site, on any driver.

2. @foreach ($terms as $term) renders nothing in Blade

$terms was a raw query builder. Query builders aren't iterable, so the Blade loop from the docs ran zero times. $terms (and the $tags-style alias) is now wrapped in Statamic\Fields\Value, which is already how query builders show up in augmented data, e.g. $entries on term pages. Iterating a Value runs the query, and method calls are forwarded to the builder.

@jasonvarga
jasonvarga merged commit 5734d14 into 6.x Oct 15, 2026
65 checks passed
@jasonvarga
jasonvarga deleted the fix/taxonomy-index-terms-site-handle branch October 15, 2026 23:44
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.

2 participants