# get_others_unpublished_posts()

URL: https://chugunov.pro/api-wordpress/functions/get_others_unpublished_posts/
Проверено на WordPress 6.9, обновлено 06.08.2026.
Источник: независимый русскоязычный справочник chugunov.pro. Не является официальной документацией WordPress.

Тип: функция.
Появился в версии: 2.3.0.

> Устаревший элемент. Помечен устаревшим с версии 3.1.0.

## Сигнатура

```php
get_others_unpublished_posts( int $user_id, string $type = 'any' ): array
```

## Описание

См. alsoget_posts()

## Параметры

- `$user_id` `int` — обязательный. Идентификатор пользователя, записи которого не нужно извлекать.
- `$type` `string` — необязательный, по умолчанию `'any'`. Тип извлекаемых записей. Принимает 'draft', 'pending' или 'any' (все).
  
  Значение по умолчанию — 'any'.

## Возвращаемое значение

`array`

## Исходный код

Файл: `wp-admin/includes/deprecated.php:694`

```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);
}
```

## История изменений

- 3.1.0 — Deprecated. Use get_posts()
- 2.3.0 — Introduced.

## Связанные

Использует: [`get_editable_user_ids`](https://chugunov.pro/api-wordpress/functions/get_editable_user_ids/), [`_deprecated_function`](https://chugunov.pro/api-wordpress/functions/_deprecated_function/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/), `wpdb::get_results`, `wpdb::prepare`.
Используется в: [`get_others_drafts`](https://chugunov.pro/api-wordpress/functions/get_others_drafts/), [`get_others_pending`](https://chugunov.pro/api-wordpress/functions/get_others_pending/).

Оригинал в официальной документации: https://developer.wordpress.org/reference/functions/get_others_unpublished_posts/
