I'm trying to add a meta box for my custom post type (which is inside a plugin).
I want to get all pages that are assigned a particular page template in my Wordpress site, so I use the following:
$surgeons = get_pages(array(
'meta_key' => '_wp_page_template',
'meta_value' => 'template-meet-the-team-single.php'
));
However, $surgeons is returned as an empty array, why?
It sounds like no page is using the template I'm stating, as if I just use the default get_pages()
it returns all pages, but this is incorrect as I definitely have pages that are assigned this template.
Does it matter that this code is in a plugin file, and the meta_value
is trying to locate this template in the plugin folder?