get_the_author() - WordPress 函数参考中文文档

返回介绍

get_the_author()

发布于 2017-09-11 字数2579 浏览 833 评论 0

get_the_author( string $deprecated = '' )

Retrieve the author of the current post.


描述


参数

$deprecated

(string)
(Optional)
Deprecated.

Default value: ”


返回值

(string|null) The author’s display name.


源代码

File: wp-includes/author-template.php

function get_the_author($deprecated = '') {
	global $authordata;

	if ( !empty( $deprecated ) )
		_deprecated_argument( __FUNCTION__, '2.1.0' );

	/**
	 * Filters the display name of the current post's author.
	 *
	 * @since 2.9.0
	 *
	 * @param string $authordata->display_name The author's display name.
	 */
	return apply_filters('the_author', is_object($authordata) ? $authordata->display_name : null);
}

更新日志

Version 描述
1.5.0 Introduced.

相关函数

Uses

  • wp-includes/functions.php:
    _deprecated_argument()
  • wp-includes/plugin.php:
    apply_filters()
  • wp-includes/author-template.php:
    the_author

Used By

  • wp-includes/author-template.php:
    get_the_author_posts_link()
  • wp-admin/includes/class-wp-posts-list-table.php:
    WP_Posts_List_Table::column_author()
  • wp-admin/includes/class-wp-media-list-table.php:
    WP_Media_List_Table::column_author()
  • wp-includes/general-template.php:
    get_the_archive_title()
  • wp-includes/author-template.php:
    get_the_author_link()
  • wp-includes/author-template.php:
    the_author()
  • Show 1 more used by
    Hide more used by


User Contributed Notes

  1. Skip to note content

    You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note

    Contributed by Codex

    Grab the Author’s ‘Public’ Name
    Grabs the value in the user’s Display name publicly as field.

    <?php $author = get_the_author(); ?>

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!