Pergunta

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.

Foi útil?

Solução

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.

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top