How to Fetch post from database

How to Fetch post from database:

<?php
 
$getpostdraft = $wpdb->get_results( 
 "
 SELECT ID, post_title 
 FROM $wpdb->posts
 WHERE post_status = 'draft' 
  AND post_author = 5
 "
);

foreach ( $getpostdraft as $drft) 
{
 echo $drft->post_title;
}
 
 ?>

 

Share on Google Plus

About Unknown

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment

0 comments:

Post a Comment