Title: get_others_unpublished_posts
Published: April 25, 2014
Last modified: February 24, 2026

---

# get_others_unpublished_posts( int $user_id, string $type ): array

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/get_others_unpublished_posts/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/functions/get_others_unpublished_posts/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/functions/get_others_unpublished_posts/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/get_others_unpublished_posts/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_others_unpublished_posts/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/get_others_unpublished_posts/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_others_unpublished_posts/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/get_others_unpublished_posts/?output_format=md#wp--skip-link--target)

This function has been deprecated since 3.1.0. Use [get_posts()](https://developer.wordpress.org/reference/functions/get_posts/)
instead.

Retrieves editable posts from other users.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/get_others_unpublished_posts/?output_format=md#description)󠁿

### 󠀁[See also](https://developer.wordpress.org/reference/functions/get_others_unpublished_posts/?output_format=md#see-also)󠁿

 * [get_posts()](https://developer.wordpress.org/reference/functions/get_posts/)

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/get_others_unpublished_posts/?output_format=md#parameters)󠁿

 `$user_id`intrequired

User ID to not retrieve posts from.

`$type`stringoptional

Post type to retrieve. Accepts `'draft'`, `'pending'` or `'any'` (all).
 Default`'
any'`.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/get_others_unpublished_posts/?output_format=md#return)󠁿

 array List of posts from others.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/get_others_unpublished_posts/?output_format=md#source)󠁿

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

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-admin/includes/deprecated.php#L694)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-admin/includes/deprecated.php#L694-L716)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/get_others_unpublished_posts/?output_format=md#related)󠁿

| Uses | Description | 
| [get_editable_user_ids()](https://developer.wordpress.org/reference/functions/get_editable_user_ids/)`wp-admin/includes/deprecated.php` |

Gets the IDs of any users who can edit posts.

  | 
| [_deprecated_function()](https://developer.wordpress.org/reference/functions/_deprecated_function/)`wp-includes/functions.php` |

Marks a function as deprecated and inform when it has been used.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  | 
| [wpdb::get_results()](https://developer.wordpress.org/reference/classes/wpdb/get_results/)`wp-includes/class-wpdb.php` |

Retrieves an entire SQL result set from the database (i.e., many rows).

  | 
| [wpdb::prepare()](https://developer.wordpress.org/reference/classes/wpdb/prepare/)`wp-includes/class-wpdb.php` |

Prepares a SQL query for safe execution.

  |

[Show 3 more](https://developer.wordpress.org/reference/functions/get_others_unpublished_posts/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/get_others_unpublished_posts/?output_format=md#)

| Used by | Description | 
| [get_others_drafts()](https://developer.wordpress.org/reference/functions/get_others_drafts/)`wp-admin/includes/deprecated.php` |

Retrieve drafts from other users.

  | 
| [get_others_pending()](https://developer.wordpress.org/reference/functions/get_others_pending/)`wp-admin/includes/deprecated.php` |

Retrieve pending review posts from other users.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/get_others_unpublished_posts/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Deprecated. Use [get_posts()](https://developer.wordpress.org/reference/functions/get_posts/)  | 
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_others_unpublished_posts%2F)
before being able to contribute a note or feedback.