get_users_drafts()

最后更新于:2021-11-27 03:38:28

get_users_drafts( int$user_id)

Retrieve the user’s drafts.

参数

$user_id

(int) (Required) User ID.

响应

(array)

源文件

文件: gc-admin/includes/user.php

function get_users_drafts( $user_id ) {
	global $gcdb;
	$query = $gcdb->prepare( "SELECT ID, post_title FROM $gcdb->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 $gcdb->get_results( $query );
}