Calling Related Entries using the Element API
You’d do this with a brand new element query using the relatedTo param.



Craft 2:

// This is the PHP equivalent of typing `craft.entries()` in a template:
$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);

// Only fetch Location entries that are related to the Site entry:
$criteria-&gt;section = 'locations';
$criteria-&gt;relatedTo = ['targetElement' =&gt; $entry];

$locations = $criteria-&gt;find();


Craft 3:

// This is the PHP equivalent of typing `craft.entries()` in a template:
$query = \craft\elements\Entry::find();

// Only fetch Location entries that are related to the Site entry:
$query-&gt;section('locations');
$query-&gt;relatedTo(['targetElement' =&gt; $entry]);

$locations = $query-&gt;all();