Skip to content

Instantly share code, notes, and snippets.

@firoz2456
Last active March 30, 2018 16:08
Show Gist options
  • Save firoz2456/816856a583e31b5815ce2e8703385a5c to your computer and use it in GitHub Desktop.
Save firoz2456/816856a583e31b5815ce2e8703385a5c to your computer and use it in GitHub Desktop.
public function get_drafts() {
global $current_user;
$my_drafts = $this->get_users_drafts($current_user->ID);
$my_scheduled = $this->get_users_future($current_user->ID);
$pending = $this->get_users_pending($current_user->ID);
}
/**
* Get all drafts post list
* @return array
*/
public function get_users_drafts($user_id) {
$args = array( 'author' => $user_id, 'post_status' => 'draft' );
$my_query = new WP_Query( $args );
return $my_query->posts;
}
/**
* Get all scheduled post list
* @return array
*/
public function get_users_future($user_id) {
$args = array( 'author' => $user_id, 'post_status' => 'future' );
$my_query = new WP_Query( $args );
return $my_query->posts;
}
/**
* Get all schedule post list
* @return array
*
*/
public function get_users_pending($user_id) {
$args = array('author' => $user_id, 'post_status' => 'pending' );
$my_query = new WP_Query( $args );
return $my_query->posts;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment