检索用户的草稿。

原型

get_users_drafts( int $user_id )

参数

$user_id (int) (Required) 用户身份。

返回值

(array)  

源文件

路径:wp-admin/includes/user.php

<?php
...
function get_users_drafts( $user_id ) {
	global $wpdb;
	$query = $wpdb->prepare("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = %d ORDER BY post_modified DESC", $user_id);
	/**
	 * Filters the user's drafts query string.
	 *
	 * @since 2.0.0
	 *
	 * @param string $query The user's drafts query string.
	 */
	$query = apply_filters( 'get_users_drafts', $query );
	return $wpdb->get_results( $query );
}
...
?>

其他

英文文档:https://developer.wordpress.org/reference/functions/get_users_drafts/