get_others_unpublished_posts
函数
get_others_unpublished_posts ( $user_id, $type = 'any' )
- 参数
-
-
(int)
$user_id
User ID to not retrieve posts from.- Required: 是
-
(string)
$type
Optional. Post type to retrieve. Accepts ‘draft’, ‘pending’ or ‘any’ (all). Default ‘any’.- Required: 否
- Default: ‘any’
-
(int)
- 返回值
-
- (array) List of posts from others.
- 相关
-
- get_posts()
- 定义位置
-
-
wp-admin/includes/deprecated.php
, line 689
-
wp-admin/includes/deprecated.php
- 引入
- 2.3.0
- 弃用
- 3.1.0
检索其他用户的可编辑文章。
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); }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。