Skip to content

Instantly share code, notes, and snippets.

@chrisjangl
Created May 17, 2019 15:03
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisjangl/4defad7968f5f5385f34c7c8886932a7 to your computer and use it in GitHub Desktop.
Save chrisjangl/4defad7968f5f5385f34c7c8886932a7 to your computer and use it in GitHub Desktop.
WordPress: SQL query to find all pages that use a certain page template. Can use WP CLI to run this query without have to log into cPanel/phpMyAdmin. Need to replace <wp_prefix_> & <page-template.php> to match your setup.
SELECT * FROM `<wp_prefix_>postmeta` WHERE `meta_key` LIKE '_wp_page_template' AND `meta_value` LIKE '<page-tempate.php>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment