返回的作者网址为空

时间:2014-03-31 14:25:28

标签: wordpress themes

我有以下代码在category.php页面上生成指向作者的链接:

<?php while ( have_posts() ) : the_post(); ?>
....
<a href="<?php the_author_meta('user_url'); ?>"><?php the_author_meta( 'display_name' ); ?></a>
....
<?php endwhile; ?>  

不幸的是,该链接获得了一个空的href属性。显示名称已正确填充。我正在使用最新的WordPress。

2 个答案:

答案 0 :(得分:1)

这不会指向作者档案。它将指向WP管理信息中心下的配置文件设置中指定的作者网址。因此,如果用户未提供网址,则该网址将为空。

答案 1 :(得分:0)

这是因为USER没有根据代码提供他的URL(这是作者url)。

签入Wordpress管理员&gt;用户&gt;所有用户&gt;选择用户并编辑特定用户的URL并进行检查。

它会出现。

希望这会对你有所帮助。