Closed mikewink closed 1 year ago
As with entry queries, the site to select from must be specified if not the current site. Here's how are you can do it with a wildcard as the site ID.
{% set mailingList = craft.campaign.mailingLists
.id(7)
.siteId('*')
.one()
%}
Hello PutYourLightsOnTeam,
I am using Craft CMS in a multisite configuration. The main site has a mailing list attached to it. I have some other sub sites that should use it in their templates too.
I use the code from the documentation for my subscription form. The code below is from the docs!
When I use this code on a sub site, I get an error message.
The initial query for the mailing list is already resulting in null. How would the hidden input for the
siteId
help with that? I tried adding the site ID as part of the mailing list query. I had no success. How would I query for the mailing list from the main site?Thank you very much for any tips on how to do it.
Best regards,
Mike