Have you ever used the same template page in the multiple pages? Do you want get the list of the pages that uses same template page in the whole site? If yes, use get_pages() function to retrieve the list of pages using the same template page.
In the get_pages() function pass the meta_key as _wp_page_template and value as template_name following template folder. Suppose, I have template page custom-cms.php inside the templates folder of theme, then my code to get the list of pages using the custom-cms.php template is :
$pages = get_pages([ 'post_type' => 'page', 'meta_key' => '_wp_page_template', 'meta_value' => 'templates/custom-cms.php ' ]);
To learn more about get_pages() function visit codex.
Views: 41