Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x]: relatedToCategories on multisite does not work when one category is disabled on other site #16875

Open
remoflury opened this issue Mar 12, 2025 · 1 comment
Assignees
Labels

Comments

@remoflury
Copy link

remoflury commented Mar 12, 2025

What happened?

Description

I got a multisite craft cms 5 instance using graphql. I got an entry type, which i can assign one ore multiple categories to it. Those categories can be be disabled or enabled on each site individually. When filtering for an entry, which has a category disabled on another site, the response will be an empty array, even if there are clearly entries on this site with this category

I am implementing a frontend filter of entries, which sends a query somewhat like this on change of the filter:

query teamQuery($siteHandle: [String], $onlyFilters: Boolean!, $teamMemberIds: [QueryArgument]) {
  entries(
    site: $siteHandle
    section: "team"
    id: $teamMemberIds
    relatedToCategories: {id: ["28235"]}
  ) @skip(if: $onlyFilters) {
    id
    title
    ... on team_Entry {
      teamCategories {
        id
        title
      }
    }
  }
}

Expected behavior

Show all filtered entries of the current site with the categories (enabled on the selected site).

Actual behavior

Show all entries of current site with the categories. but if the filtered category is disabled on another site, no entry is shown.

Craft CMS version

5.6.11

PHP version

8.3.17

Operating system and version

No response

Database type and version

mysql

Image driver and version

No response

Installed plugins and versions

@i-just
Copy link
Contributor

i-just commented Mar 13, 2025

Hi, thanks for reporting! It looks like this will happen if the category is disabled for the primary site. I raised a PR for this.

If you need this to work straight away, you can modify the relatedToCategories part to use any site, like so: relatedToCategories: [{id: ["12345"], site: "*"}].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants