Domanda

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.

È stato utile?

Soluzione

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.

Altri suggerimenti

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top