Previously (up to version 4.1.2) only the pages starting with numbers (e.g. 01_page, 02_another_page) were included in the main menu. After upgrading to version 4.2.0 all pages are listed in the menu. The menu.php has not changed and it is the same as in:
It is an old installation (updated many times) which I updated by replacing the kirby folder with the one from version 4.2.0. Fresh starterkit seems to work fine indeed, but there is no menu.php there. Reverting back the installation to 4.1.2 works fine too.
I don’t know enough php to debug it, but replacing $items = $pages->listed();
in menu.php with hard coded list of pages fixed the issue.
My guess is that for some reason the behavior of that $pages->listed() has changed in 4.2.0 at least in certain conditions.
The menu.php file is identical to the one from the Kirby Cookbook in the link my first post. I even replaced the menu.php file on my site with the Cookbook one to make sure that there is no some subtle difference but the problem still persists. After replacing