get_pages() Not Returning Posts with 'meta_key' and 'meta_value'
-
Greetings!
I’m in the process of building an install for a client, when I noticed that one of my custom functions wasn’t working. The function is designed to return an array that is specially designed for the rendering of a ‘select’ option field.
The function points to a few other custom functions before the actual output is rendered. However, when I started noticing problems, I “cut out the middle man,” so to speak, and replaced the function code with this:
$pages = get_pages( array( 'sort_column' => 'menu_order', 'meta_key' => '_wp_page_template', 'meta_value' => 'page-bio.php' ) ); print_r( $pages );
The array should contain pages of a particular page template (page-bio.php). I can look in the database, in the ‘postmeta’ table, and see that there is at least one page using the page template ‘page-bio.php’. Yet the output of the above code is as follows:
Array ( )
I’ve looked through the get_pages() code in /wp-includes/post.php, I’ve checked, double-checked, and triple-checked everything to make sure it’s all solid. I can’t for the life of me figure out why get_pages() isn’t returning the pages like it should.
Any ideas?
(Many thanks in advance.)
- The topic ‘get_pages() Not Returning Posts with 'meta_key' and 'meta_value'’ is closed to new replies.