Created
May 17, 2019 15:03
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
To run query using WP CLI:
wp db query "SELECT * FROM '
<wp_prefix_>postmeta` WHEREmeta_key
LIKE '_wp_page_template' ANDmeta_value
LIKE '<page-tempate.php>'"