Last active
December 11, 2015 04:20
-
-
Save Aziz-Rahman/140b92354486594cb8dc to your computer and use it in GitHub Desktop.
Display post based without a feature image in wp
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
global $wpdb; | |
/* -- Preparing your query -- */ | |
$query = "SELECT wp_posts.* FROM wp_posts | |
LEFT JOIN wp_postmeta ON ( $wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->postmeta.meta_key = '_thumbnail_id' ) | |
WHERE $wpdb->posts.post_type = 'photo' AND ( $wpdb->posts.post_status = 'publish' ) AND ( $wpdb->postmeta.post_id IS NULL )"; | |
// $wpdb->posts.post_type = 'photo' -------> custom post type |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment