質問

I have the following code to generate the link to the author on a category.php page:

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

Unfortunately, the link get an empty href attribute. The display name is populated properly. I am using the latest WordPress.

役に立ちましたか?

解決

That won't point to the author archive. It'll point to the author's URL as specified in their profile settings under the WP admin dashboard. So if a user hasn't provided a URL then it will be empty.

他のヒント

It is because the USER haven't provided his URL (this is author url) according to the code.

Check in Wordpress Admin > Users > All Users > choose the user and edit the URL for the particular user and check.

It will show up.

Hope this helps you.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top