It make use of global variable $post
to get author id of current post. Using that this function returns the author url.
Note –
Make sure you put this in condition (
is_single()
) so it only print author url onsingle.php
.
<?php echo get_author_posts_url( $post->post_author ); ?>
Update –
<?php $username = get_userdata( $post->post_author ); ?>
<a href="https://wordpress.stackexchange.com/questions/61367/<?php echo get_author_posts_url( $post->post_author ); ?>"><?php echo $username->user_nicename; ?></a>
This will work, but I’ll update my answer if I found more efficient method.
Related Posts:
- How to get Author ID outside the loop
- Display all authors and their only one latest post
- Display Authors in a grid loop
- Cannot retieve the_content() and the_author() – both returning empty strings
- Get author_id in wordpress
- How can I display other user avatars on an author profile page?
- Can’t grab author info outside of the loop
- Saving return value from the_author_posts_link()
- Display more than 10 posts on author.php file
- How to add a byline to all the pages?
- List ALL posts by author on author archive
- Displaying posts limit: can’t get pagination to display [duplicate]
- Exclude Authors based off date of last post
- How to show list of posts by author and category?
- Get date of last update outside of loop
- Changing behavior of the loop twice in one page
- Show scheduled posts in archive page
- Find most recent authors
- post__in – Placing content from a foreach loop inside of an array
- loop query exclude meta_key with meta_value
- Displaying child page content of a certain parent
- Pagination adding extra posts only on page 2
- If Loop has odd number of posts on last page Custom style for last post in it
- Custom page template
- Get posts that matches specific terms of multiple custom taxonomies
- add_filter() doesn’t work in loop
- The Loop in Static Page
- How can I use get_permalink() outside the loop?
- Content/Excerpt length control for a specific loop?
- Two loops by pre_get_post on same page
- How to check for specific content in comments in the loop
- Get List of all the Authors
- Problem the_permalink
- Loop posts only excluding first post
- Loop repeating design pattern
- Can’t access login screen, wp-login.php 404’s
- Create static front-page with 3-5 recent posts
- Customize WooCommerce Product Images (Placement and size) [closed]
- Create a loop that gets pages with their template
- get latest 5 posts and a specific post and sort in a specific order
- How to check if a post exist?
- How to use current_post to open a new unordered list every five posts
- Why cant you place the Loop outside of the index.php?
- sticky post in custom loop
- Pagination for multiple loops
- Infinite Scroll on a loop?
- On single.php, fetch 2 posts created after and 2 posts created before in relation to the actual post (using menu_order)
- Post classes in the loop are being changed in certain themes
- Exclude page name from loop
- PHP if post is already displayed, then
- How to style first post differently with ‘get_template_part’?
- How can I improve the performance of this query_posts loop?
- Add leading zero to current post display [closed]
- Distribute Gallery Images Every nth in Loop
- WordPress Image Slider Looping Title Not Working
- Change all author links in Blog roll
- Is there any good reason for two CSS files to @import each other?
- Adding div after every two post on main loop! Why will first post not get counted?
- Stomping WP_Query in author archive to facilitate pagination with custom queries
- Second Loop Showing Only One Post on Single Post Page
- Pulling in featured image into default recent posts widget
- Random post link generator messes up the loop
- how can i order the category by date
- Change position of entry title
- excerpt not showing up
- Announces with different formatting dependently on a number
- Override orderby to create list of users by custom meta_value
- Loop info in jquery Tabs – loop into a variable?
- Thumbnail Image Rounded Corners w CSS (or any other good method)
- Several loops in sidebar issues
- List page is showing 404
- Duplicated tag in loop
- Insert content above an embedded video inside Wordress’ php the_content
- Loop only shows first two posts
- Why is my archive page looping through all but one post?
- Loop two different category WP_Query
- Use ACF Category Image for all Taxonomy Archive Views
- Loop with custom posts, to include information from different custom post type
- the loop printing post in one grid
- Transient not working for external data
- adding tax_query to $query_string
- Remove posts_orderby filter then add it back in
- the_title() Returns the page title instead of the post
- WP update_post_meta link loop
- How do I aproach this?(for sale, for lease, sold->move something from a category to another)
- How to fix pagination for custom loops?
- query_posts ignores the argument
- Conditional Check in The Loop’s Parameters
- How does the JSON API work to parse incoming JSON and fetch a post based on an ID?
- How to add excerpt in loop in Twenty Eleven theme?
- show posts from one category with comments only
- Loop from another WP site onto mine
- How to implement template file and the loop
- Show only posts from todays date [duplicate]
- I need to update the post query? [closed]
- Wrap every 2 divs in row – for each loop [closed]
- How to add class to the last image of the last post in a loop
- Multiple loop with pagination in same page
- Why did my most recent article fall behind an older one on my site?
- Hook in the loop after the first post