Created
January 10, 2017 16:28
-
-
Save fastmover/776c07db5e681ec4c562b7500303a62f to your computer and use it in GitHub Desktop.
Get a WordPress featured image by Post ID, replace 12345 with your post ID.
This file contains hidden or 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 | |
| `wp_postmeta_1`.`meta_value` | |
| FROM | |
| `wp_postmeta` | |
| INNER JOIN `wp_postmeta` `wp_postmeta_1` | |
| ON `wp_postmeta`.`meta_value` = `wp_postmeta_1`.`post_id` | |
| WHERE | |
| (`wp_postmeta`.`post_id` = 12345) AND | |
| (`wp_postmeta`.`meta_key` = '_thumbnail_id') AND | |
| (`wp_postmeta_1`.`meta_key` = '_wp_attached_file') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment