You can use get_the_author_meta()
which returns the requested data of the author of the current post. If you’re on the author archive page (e.g. author.php) that will be the ID of the user whose profile you are on.
get_the_author_meta( 'ID' );
Related Posts:
- Display if author page is author page of current user
- Query posts by post type, author and post meta
- Getting all user metadata from user
- author.php with ACF and CPTs
- Query to return maximum of one post per author
- How to add custom query filters in WP_User_Query
- Show only oldest post by author
- Function to check if author has posted within the last x days
- Show one post per author and limit query to 8 posts
- Filter user list that meta_value is empty
- Query wp_usermeta alongside wp_users
- Pagination 404 errors for author posts query on author.php
- SQL User Query by Multiple Roles using PHP
- Only display authors who have posts
- WP-Admin edit.php & post.php slowdown after import of 10k users
- Get List of all the Authors
- WP User Query get all authors with last name starting with specific letter
- Sort users by “birthday” using WP_User_Query
- Hide Administrators From User List except current user (administrator)
- How can I display list of all posts from a specific author, with publish dates in the future, on an author archive page (author.php)?
- Get authors by term id or slug
- How to display user order by role
- Import wp users via one click demo option
- Custom Query by Author field and meta
- slow WP_Query for non-admin user
- WP_Query (list) posts according to author’s custom field
- Exclude some authors from query
- Get author if post has multiple authors
- All posts returned when author of 0 is queried
- Prevent author bio page from showing in search results
- Get multiple users with meta value in one query and populate WP_User class
- Posts in loop all show the same author when there are many authors
- Reduce number of SQL queries inside WP_Query loop to fetch author data
- Stomping WP_Query in author archive to facilitate pagination with custom queries
- Get user first name from custom endpoint
- Exclude authors IDs from WP_Query
- WP_Query author parameter not working
- Storing an array of objects related to each user
- Create one-use post dynamically, add to main query, do not insert post (user profile view)
- query post by author gender
- How can i show pagenavi in my author.php?
- Query to get last posts from authors of blog
- Query pages created by deleted users
- wp query to use both author id and meta_query
- Counting instances of words in the results of a post query
- Random users always showing same 8 users
- Get authors list and sort them by recent posts
- Set “editor” role to existing user
- How to query 5 users in random who have published more than 10 posts
- How to query users by post count no less than 10
- Merge wp-query and get_users
- Get all wp_users sort by metakey
- query all posts published by certain user id
- Logging search queries for logged-in users
- List users by Year of Birth using a foreach loop to dynamically populate years and data
- Show subscriber id in loop
- WP Query get posts by specific author IDs if one of several logged in authors
- Query Users by post count, last 30 days and display each users post count according to post type
- Get users query makes the site loading time too big?
- Get all user with both meta_value
- Group users by meta field, with name of meta field as group title
- WP_QUERY with both author and post_type set (makes me crazy)
- Include posts with a specific custom taxonomy term in author page
- How to remove “MY WORDPRESS”” Label
- Date not appearing in custom query
- Custom taxonomy in WP_Query not working
- Custom post type – filter content by custom meta box content
- Trying to output content from page, works locally but not online
- Add category to my get_post query
- Ajax (jquery) wp_query pagination returns -1
- Why always one post missing
- Query WP Page for Buddypress Group Home [closed]
- How to sort by most watched in X days/months
- Admin: Custom Query Returning Permissions Error
- Using WP_Query with multiple loops on one page in search.php
- Modify output of custom loop using WP_query
- Help with Wp Query
- What’s wrong with this wpdb query?
- How to stack name list in non-alphabetical order?
- How to get pages of parent (non-recursive)?
- Magazine style frontpage with multiple categories/loops and no duplicate posts
- Display upcoming events in the next 30 days by querying posts with timestamp in custom meta
- orderby ignored by wp_query
- How can I change the term “Published” next to # of posts published on WordPress dashboard All Posts page?
- Multiple loops breaking side bar
- $post in wp_query?
- Having a variable based on $post_count increase when i move to the next page of results
- Post order by custom fields
- WP_Query and pagination AGAIN?
- WP Query get only 1 post (sticky, not sticky etc)
- WP Query and multiple pages
- how do I write this wp_query select statement?
- Page template doesn’t display simple HTML if inserted into other page?
- WP_Query not returning correct result with meta_query parameter
- How to pass the current content of $wp_query to a new page?
- How to make the ‘request’ filter work?
- problem with the loop
- How to use rewind_comments() – when and how to use it?
- Trouble passing attribute into shortcode function
- How to make a query returning pages from multiple parents