the_author_ID()
says in Codex:
It displays the unique numeric user ID for the author of a post; the ID is assigned by WordPress when a user account is created. This tag must be used within The Loop.
So, it won’t work.
Try using the following code* within a loop:
<li class="author vcard">
<a class="url fn n" href="https://wordpress.stackexchange.com/questions/113653/<?php echo get_author_posts_url( false, $authordata->ID, $authordata->user_nicename ); ?>" title="<?php printf( __( 'View all posts by %s', 'my-theme' ), $authordata->display_name ); ?>"><?php the_author(); ?></a>
</li>
* Thanks to Ian Stewart
Related Posts:
- Change the Author Slug from Username to Nickname
- Change the author slug from nickname to ID
- How to let contributors to create a new revision(draft) editing their published posts
- Display edit link if post author is current user
- Force display name as full name
- Authors Page : A page of authors
- Completely hide user info
- Total Word Count For Posts And Comments By One Author
- Users roles, make a page belonging to multiple users
- Is there any function available to echo current user’s profile url?
- the_author_meta(‘user_url’, $author->ID) not working properly. how can I solve this?
- Where is the information about the authors for articles stored?
- Split Blog Into Two Sections?
- Getting author page slug from get_users() or get_userdata() functions
- Delete User via Frontend
- How to force authors to ‘submit for review’?
- Create Next and Previous Link to User orderby Last Name
- How to implement friend system for WordPress?
- Creating User Profiles using author.php
- Show only the first 300 words / 50 lines of blog posts for non registered users
- Author comment count in author page
- Order users by user role
- How can I set wp_dropdown_users so that it shows only authors?
- How to create page for user?
- How do I tag every author in their posts that they have made previously
- How do I change the user via SQL?
- Add new user and user bio at same time
- show count author post today
- How to allow an user role to create a new user under a role which lower than his level only?
- How to programatically change username (user_login)?
- How to get userid at wp_logout action hook?
- What’s the difference between the capability remove_users and delete_users?
- How to change user_login with wp-cli?
- Replacing the WordPress password validation
- How to display a public profile page for registered users with custom slug?
- alphabetically order role drop-down selection in dashboard
- How to hide media uploads by other users in the Media menu?
- Get users with atleast one post
- edit profile validation refreshes all field if missing wordpress
- How to order users alphabetically by their last name?
- How to use hyperdb to separate and share a user dataset between wordpress installs?
- Return ID of authors who have at least one post
- How to list users that have written custom post types and hide the ones that have not?
- Front end user meta options for users
- Drop down list in user profile page
- How can I link users across multiple subdomains?
- Importing Existing Users with Passwords
- Create not-activated user in code, wordpress
- How can I allow users to sign up but prevent them from accessing the WordPress backend?
- How to delete all post and attachments of a user when I delete it?
- Redirect user to login before viewing custom post
- Force user to change their password on first log in of site using shortcode
- How to export bbPress (forums, topics, replies) and all users?
- Display users in order by an “order” custom meta field
- Translate emails into the language of the user
- WP users page doesn’t show users count by role
- Can I check which users ran which updates?
- Extend backend User search to custom user meta
- Move users and passwords from one wordpress site to another
- Bulk lock users without email address?
- Failed login attempts
- Delete user after Contact Form 7 submission [closed]
- Best way to get user id for get_users function?
- How to hide user profile fields based on the role of the viewed user?
- user_meta table in staging vs live site
- Get usermeta info from sql query
- redirect user to their profile after log in
- Get current user array into hyperlink
- how do I add role and capability after I create a new user
- Get Authors Role
- How to use `wp_insert_user` & `wp_insert_post` simultaneously without `headers already sent` error?
- Changing user of post by changing ‘post_author’ field in ‘wp_posts’ table not taking effect. Where is the real post author info kept?
- How to auto-generate names for guest users who leave comments?
- Edit text of WordPress “Register” button
- How to safely trigger password reset emails for thousands of users
- How to remember which page the user was on before logout?
- SQL to set Display Name to First Name + Last Name
- how to retrieve user via rest api using custom meta and/or email
- How to customize user rest api?
- How to limit specific user ID to 5 comments per post?
- Hook into add_user_role and update based on new and removed roles
- REST API list_user
- meta_query orderby sort multiple keys
- Updated user role inncorrect when using wp_get_current_user()
- Custom registration fields not appearing in user info
- Grab user_id inside a function
- Show user details only
- Creating custom pages for new users automatically
- Output checkbox per user and save in plugin options
- Require confirmation of current user’s email before updating database and before send_email_change_email
- post acces for guests / unregistered users only
- Track users views
- user added by(who added this user)
- User list order by user meta
- What’s the most secure way to grant a user permission to update in a multisite?
- User email not being changed (cached?) until next page load (frontend)
- logged_in user outside of wordpress loop
- Create a wordpress admin user and only let them edit and post blog posts?
- Shopping plugin with user groups [closed]
- How to allow users to make quizzes or tests in WordPress?