get_author_feed_link()
get_author_feed_link( int $author_id, string $feed = ” …
get_author_feed_link( int $author_id, string $feed = ” )
检索给定作者的源链接。
Retrieves the feed link for a given author.
目录锚点:#说明#参数#返回#源码#笔记
说明(Description)
返回指向给定作者的所有文章的源的链接。可以请求特定提要,也可以将其留空以获取默认提要。
参数(Parameters)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| $author_id | (int) | 必需 | 作者ID。 |
| $feed | (string) | 可选 | 进给类型。可能的值包括“rss2”、“atom”。Default是get_Default_feed()的值。 |
返回(Return)
(string)指向由$authoru id指定的作者的源的链接。
源码(Source)
/**
* Retrieve the feed link for a given author.
*
* Returns a link to the feed for all posts by a given author. A specific feed
* can be requested or left blank to get the default feed.
*
* @since 2.5.0
*
* @param int $author_id ID of an author.
* @param string $feed Optional. Feed type.
* @return string Link to the feed for the author specified by $author_id.
*/
function get_author_feed_link( $author_id, $feed = '' ) {
$author_id = (int) $author_id;
$permalink_structure = get_option('permalink_structure');
if ( empty($feed) )
$feed = get_default_feed();
if ( '' == $permalink_structure ) {
$link = home_url("?feed=$feed&author=" . $author_id);
} else {
$link = get_author_posts_url($author_id);
if ( $feed == get_default_feed() )
$feed_link = 'feed';
else
$feed_link = "feed/$feed";
$link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed');
}
/**
* Filter the feed link for a given author.
*
* @since 1.5.1
*
* @param string $link The author feed link.
* @param string $feed Feed type.
*/
$link = apply_filters( 'author_feed_link', $link, $feed );
return $link;
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 2.5.0 | wp-includes/link-template.php:789 | 3 | 8 |
笔记(Notes)
返回作者2发布的rss2提要链接
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。
还没有任何评论,赶紧来占个楼吧!