Created
April 8, 2015 13:09
-
-
Save lucasstark/85a76eda73c83f3418eb to your computer and use it in GitHub Desktop.
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
$exists = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status = %s AND ID = %d", 'you-post-type', 'publish', $your_post_id)); | |
if (!empty($exists) && !is_wp_error( $exists )){ | |
//post exists. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment