从其他用户检索可编辑的帖子。

原型

get_others_unpublished_posts( int $user_id, string $type = 'any' )

参数

$user_id (int) (Required) 用户ID无法从中检索帖子。

$type (string) (Optional)  要检索的帖子类型。接受’草稿’,‘待定’或’任何’(全部)。

返回值

(array)  来自其他人的帖子列表。

源文件

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

<?php
...
function get_others_unpublished_posts( $user_id, $type = 'any' ) {
	_deprecated_function( __FUNCTION__, '3.1.0' );
	global $wpdb;
	$editable = get_editable_user_ids( $user_id );
	if ( in_array($type, array('draft', 'pending')) )
		$type_sql = " post_status = '$type' ";
	else
		$type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) ";
	$dir = ( 'pending' == $type ) ? 'ASC' : 'DESC';
	if ( !$editable ) {
		$other_unpubs = '';
	} else {
		$editable = join(',', $editable);
		$other_unpubs = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified $dir", $user_id) );
	}
	return apply_filters('get_others_drafts', $other_unpubs);
}
...
?>

其他

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