function wp_exist_post_by_title( $title ) { global $wpdb; $return = $wpdb->get_row( "SELECT ID FROM wp_posts WHERE post_title = '" . $title . "' && post_status = 'publish' && post_type = 'post' ", 'ARRAY_N' ); if( empty( $return ) ) { return false; } else { return true; } } // usage if( wp_exist_post_by_title( $post->name ) ) { // post exist } else { // post does not exist }