简体   繁体   中英

Wordpress: How get link to author page without author ID?

How get link to default author page without author ID?

I can use <?php echo get_author_posts_url(''); ?> <?php echo get_author_posts_url(''); ?>

and it give me http: //mysiteadress/?author=0

I need link to http: //mysiteadress/?author without =0

Of course I can use something like this:

<?php echo esc_url( home_url( '/?author' ) ); ?>

... but if someone change in wordpress admin panel Settings->Options permalink, this solution not be flexible...

That's not possible. The =0 is the ID of the author. if you have multiple authors it could be =123 too. So if you remove the ID from the URL Wordpress won't be able to recognize which author do you want to see.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM