Menu tree page data not rendering any data if the page does not exist in drupal 7 I have this code to render the menu. I need to make extensive modifications of the elements, so this is why I extract it in this way (multidomain-multilanguage site, I tried everything and this was the only solution I found):

$a = menu_tree_output( menu_tree_page_data("main-menu") )


It works perfectly and $a is an array full of content. Works for every page, except for 404 not found pages. There it returns an empty array.

Any help would be appreciated. I was thinking of storing the menus for the different languages and domains in the database in a personal table and checking if array is empty, in order to extract the info, but I think that is not a good solution. Thank you!!!
I have guessed what happens. It seems that Drupal does not render much of the content in order to aliviate load of the system. So in admin / site / site-information, you establish a different page for 404, and you can customize it. It will now include all menu, links, etc. and personal translatable messages you want to add.