函数原型
post_author_meta_box( WP_Post $post )
函数描述
Displays form field with list of authors.
是否弃用
未弃用
函数参数
-
$post
WP_Post
Required - Current post object.
函数返回值
无
函数位置
File: wp-admin/includes/meta-boxes.php.
函数源码
function post_author_meta_box( $post ) {
global $user_ID;
$post_type_object = get_post_type_object( $post->post_type );
?>
<label class="screen-reader-text" for="post_author_override"><?php _e( 'Author' ); ?></label>
<?php
wp_dropdown_users(
array(
'capability' => array( $post_type_object->cap->edit_posts ),
'name' => 'post_author_override',
'selected' => empty( $post->ID ) ? $user_ID : $post->post_author,
'include_selected' => true,
'show' => 'display_name_with_login',
)
);
}
源码链接
变更日志
| Version | Description |
|---|---|
| 2.6.0 | Introduced. |

