Why does ‘meta_key’ return an empty array in get_pages

I’m not sure if this is still true, but i tried this one time and found a similar question:

Understand this is not my answer, but what i found that ended up working. It was a year ago, and I haven’t tried if querying by meta_key works yet…
From this question:

https://stackoverflow.com/questions/32104826/wordpress-get-pages-meta-key-dont-show-page

This is the answer that was provided:

As of now WordPress documentation for get_pages() says the function doesn’t support querying with a meta_key:

NOTE: This function will currently not retrieve pages using the ‘meta_key’ and ‘meta_value’ parameters in the $args array as described below. Until this is fixed in the WordPress codebase, you may want to use get_posts() instead.

So your code should call get_posts() instead:

$pages_args = array(
  'orderby' => 'menu_order',
  'parent' => 0,
  'post_type' => 'page',
  'post_status' => 'publish',
  'meta_key'  => 'dont_show_in_nav',
  'meta_value' => 'true'
);
$pages = get_posts($pages_args);

Note that I quoted ‘true’, since to WordPress it’s just a text field. Also, some arguments for get_posts are slightly different than for get_pages.