函数文档

get_others_drafts()

💡 云策文档标注

概述

get_others_drafts() 是一个已弃用的 WordPress 函数,用于检索其他用户的草稿。它已被 get_others_unpublished_posts() 替代,自版本 3.1.0 起不建议使用。

关键要点

  • 函数 get_others_drafts($user_id) 接受一个必需的整数参数 $user_id,表示用户 ID。
  • 返回一个数组,包含其他用户的草稿列表。
  • 该函数在 WordPress 3.1.0 版本中引入,并同时被标记为弃用,建议使用 get_others_unpublished_posts() 替代。
  • 相关函数包括 get_others_unpublished_posts() 和 _deprecated_function()。

代码示例

function get_others_drafts($user_id) {
    _deprecated_function( __FUNCTION__, '3.1.0' );
    return get_others_unpublished_posts($user_id, 'draft');
}

注意事项

由于该函数已弃用,开发者应避免在新代码中使用,并迁移到 get_others_unpublished_posts() 函数。


📄 原文内容

Retrieve drafts from other users.

Description

See also

Parameters

$user_idintrequired
User ID.

Return

array List of drafts from other users.

Source

function get_others_drafts($user_id) {
	_deprecated_function( __FUNCTION__, '3.1.0' );

	return get_others_unpublished_posts($user_id, 'draft');
}

Changelog

Version Description
3.1.0 Introduced.