How to Find Posts/Pages Using a Custom WordPress Template

Posted:

To find out which WordPress posts and/or pages are using a specific custom template, e.g., template-file.php, run the following MySQL query:

SELECT * FROM `wp_postmeta` WHERE `meta_value`='template-filename.php';