I'm looking for a way to list all the enabled sites for a given entry. I couldn't find some sort of getEnabledSites method that's similar to the available getSupportedSites. The latter only returns the siteId and enabledByDefault properties.

Note that I'm doing this within the Element API plugin.

  • Do you want to get all available sites for the element or all sites where enabledForSite is true? Jun 6, 2018 at 5:02
  • @RobinSchambach I want the latter, i.e. "all sites where enabledForSite is true". The available sites can be retrieved using the getSupportedSites method.
    – biko
    Jun 6, 2018 at 5:15

2 Answers 2


Totally untested but this should work

$enabledSiteIds = (new Query())
        'enabled' => true,
        'elementId' => $elementId

You might want to join the elements and entries table in order to gain only elements where elements.enabled is true too (and check the expiry date), otherwise you'll receive disabled entries


$entry->getLocalized()->all() will return an array of the same entry in other locales. You could map that into a list of all of the site's handles:

array_map(function($entry)  {
  return $entry->site->handle;
}, $entry->getLocalized()->all())


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.