get_others_unpublished_posts() WP 2.3.0
Устарела с версии 3.1.0. Больше не поддерживается и может быть удалена. Используйте get_posts().╳
Retrieves editable posts from other users.
Хуки из функции
Возвращает
Массив. List of posts from others.
Использование
get_others_unpublished_posts( $user_id, $type );
- $user_id(число) (обязательный)
- User ID to not retrieve posts from.
- $type(строка)
- Post type to retrieve. Accepts 'draft', 'pending' or 'any' (all).
По умолчанию: 'any'
Заметки
- Смотрите: get_posts()
- Global. wpdb. $wpdb WordPress database abstraction object.
Список изменений
С версии 2.3.0 | Введена. |
Устарела с 3.1.0 | Use get_posts() |
Код get_others_unpublished_posts() get others unpublished posts WP 5.6.2
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);
}