# $pages-\>find() not working as expected?

**URL:** <https://forum.getkirby.com/t/pages-find-not-working-as-expected/24531>\
**Category:** Questions\
**Tags:** v3\
**Created:** [January 21, 2022, 9:45am UTC](https://forum.getkirby.com/t/pages-find-not-working-as-expected/24531 "2022-01-21T09:45:16Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![till\_k](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@till\_k](https://forum.getkirby.com/u/till_k)\
**Post date:** [January 21, 2022, 9:45am UTC](https://forum.getkirby.com/t/pages-find-not-working-as-expected/24531/1 "2022-01-21T09:45:17Z")

</div>

Hi,

I recently updated a site to Kirby 3 and found something strange: `$pages->find()` is not working as it did before. I used to get a result for `$site->grandChildren()->find('page-title')`, which is not working anymore. However, if I use `$site->grandChildren()->findBy('uid', 'page-title')`, using the identical page title, I get the page I want. To my understanding, those two lines should return the same page, right? At least that’s what they used to do.  
Is this expected, or user error, or a bug?

Thanks,  
Till

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [January 21, 2022, 9:51am UTC](https://forum.getkirby.com/t/pages-find-not-working-as-expected/24531/2 "2022-01-21T09:51:53Z")

</div>

> [@till\_k](#):
>
> I recently updated a site to Kirby 3

From which Kirby version did you update? `find()` expects a page id as parameter, not the title.

---

<div class="post-metadata">

**Author:** ![till\_k](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@till\_k](https://forum.getkirby.com/u/till_k)\
**Post date:** [January 21, 2022, 9:58am UTC](https://forum.getkirby.com/t/pages-find-not-working-as-expected/24531/3 "2022-01-21T09:58:41Z")

</div>

I updated from 3.4 to 3.6.1.1

I am giving a uid as parameter to `find()`, I use the same parameter that I use for `findBy('uid')`, which works fine.

Another thing I just noticed: the code that uses `find()` works fine in the two secondary languages on my site (German and French), but not in the first language (English). The UID of the page that is to be found is identical in all three languages. `findBy('uid')` works across all languages, `find()` only returns a result in German and French.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [January 21, 2022, 10:07am UTC](https://forum.getkirby.com/t/pages-find-not-working-as-expected/24531/4 "2022-01-21T10:07:34Z")

</div>

Hm, yes, I can reproduce the issue. It works if you pass the id, e.g. in a Starterkit:

```auto
<?= $site->grandChildren()->find('notes/exploring-the-universe')->title() ?>

```

While it works with the slug in case of non-default languages.

---

<div class="post-metadata">

**Author:** ![till\_k](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@till\_k](https://forum.getkirby.com/u/till_k)\
**Post date:** [January 21, 2022, 10:22am UTC](https://forum.getkirby.com/t/pages-find-not-working-as-expected/24531/5 "2022-01-21T10:22:11Z")

</div>

So am I correct in my understanding: the correct behavior would be that `$pages->find()` should not work with uids and only works with the full ids? Basically I was using it wrong before, which used to work and now stopped working in the default language but somehow still works in non-default languages?

If this is correct, then it was a bug before and now is still (but somehow less of) a bug. Or maybe it was a feature before (being able to use `$pages->find()` with a uid/slug) which now is not working correctly anymore?

Anyhow, I updated my code to use `$site->grandChildren->findBy('uid', page-slug)`, so there’s a solution 🙂

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [January 21, 2022, 10:57am UTC](https://forum.getkirby.com/t/pages-find-not-working-as-expected/24531/6 "2022-01-21T10:57:24Z")

</div>

Hm, might actually be a bug, given that it works as expected in a non-multilang installation.

---

<div class="post-metadata">

**Author:** ![till\_k](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@till\_k](https://forum.getkirby.com/u/till_k)\
**Post date:** [January 21, 2022, 11:47am UTC](https://forum.getkirby.com/t/pages-find-not-working-as-expected/24531/7 "2022-01-21T11:47:14Z")

</div>

Thanks for you help!  
How does it work – do you report the bug, should I do something?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [January 22, 2022, 11:44pm UTC](https://forum.getkirby.com/t/pages-find-not-working-as-expected/24531/8 "2022-01-22T23:44:13Z")

</div>

> <https://github.com/getkirby/kirby/issues/4105>
>
> \## Description
> This code used to work:
> 
> \`\`\`
> \<?= $site-\>grandChildren()-\>find…('exploring-the-universe')?\>
> \`\`\`
> 
> And still does in a non-language installation.
> 
> However, it doesn't work in a multilanguage installation \*\*for the default language\*\*, while it works for the non-default languages.
> 
> \*\*Expected behavior\*\*  
> The code should return the given page in all circumstances.
> 
> 
> \## Your setup
> \*\*Kirby Version\*\*  
> 3.6.1.1
> 
> 
> \*\*Additional context\*\*  
> \[\](https://forum.getkirby.com/t/pages-find-not-working-as-expected/24531)
