On a sea开发者_运维百科rch page I allow the user to click a on the authors name to view all posts by that author. Im trying to create the link to the authors page but I keep getting 404’s. However the admin user works. I have checked the user types and they are set authors (Admin is administrator).
Code Example
get_author_posts_url(get_the_author_ID());
Result
This returns "/author/tester/" which looks correct since the admin one "/author/admin/" works. However clicking the link goes to 404.
Notes
- This code is executed in a Wordpress loop.
- User type is Author.
- Ideally I would like to use the users nickname/display name not actual.
Try :
get_author_posts_url( $author->ID )
Also since you're using it within the loop, try without any ID :
get_author_posts_url()
精彩评论