Wordpress WordPress query to fetch the pages April 12, 2011 Pramod T P Leave a comment <?php global $wpdb; $querystr = " SELECT distinct(post_title) ,ID,post_title FROM $wpdb->posts WHERE post_type='page' AND post_status='publish' "; $pageposts = $wpdb->get_results($querystr, OBJECT); ?>