function fix_canonical() {
global $paged;
if (is_category()) {
$catid = get_query_var('cat');
echo '
<link rel="canonical" href="'.get_category_link($catid).'" />
<meta name="description" content="'.$meta.'" />';
if ($paged > 1) echo '
<meta name="robots" content="noindex,follow" />';
} else {
echo '';
}
if (is_tag()) {
$tagid = get_query_var('tag_id');
echo '
<link rel="canonical" href="'.get_tag_link($tagid).'" />';
if ($paged > 1) echo '
<meta name="robots" content="noindex,follow" />';
} else {
echo '';
}
}
add_action('wp_head', 'fix_canonical');
函数.php
如您所见,我在代码中获得了类别和标签档案的根永久链接。现在我想获取作者的存档链接。我该怎么做?