# ParentLocationId Criterion

The [`ParentLocationId` Search Criterion](https://doc.ibexa.co/en/latest/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-Criterion-ParentLocationId.html) searches for content based on the Location ID of its parent.

## Arguments

- `value` - int(s) representing the parent location IDs

## Example

### PHP

```
$query->query = new Criterion\ParentLocationId([54, 58]);
```

### REST API

**XML**

```
<Query>
    <Filter>
        <ParentLocationIdCriterion>[81, 82]</ParentLocationIdCriterion>
    </Filter>
</Query>
```

**JSON**

```
"Query": {
    "Filter": {
        "ParentLocationIdCriterion": [69, 72]
    }
}
```

## Use case

You can use the `ParentLocationId` Search Criterion to list blog posts contained in a blog:

```
$query = new LocationQuery();
$query->query = new Criterion\LogicalAnd([
    new Criterion\Visibility(Criterion\Visibility::VISIBLE),
    new Criterion\ParentLocationId($locationId),
]);

$results = $this->searchService->findLocations($query);
$posts = [];
foreach ($results->searchHits as $searchHit) {
    $posts[] = $searchHit;
}

return $this->render('full/blog.html.twig', [
    'posts' => $posts,
]);
```

```
<p>Posts:</p>
<ul>
    {% for post in posts %}
        <li>{{ post.valueObject.contentInfo.name }}</li>
    {% endfor %}
</ul>
```
