To get the username of a user you can use the get_userdata() function.
Pass it the users ID
$user = get_userdata($user_id);
Then the have access to the username or user_login as its called
echo $user->user_login;
You can read more about this function here:
https://codex.wordpress.org/Function_Reference/get_userdata
Or if you need to get the user by other information, see get_user_by()
https://developer.wordpress.org/reference/functions/get_user_by/
Related Posts:
- Can wp_query return posts meta in a single request?
- Meta query with string starting like pattern
- compare meta_query in get_posts arguments
- Function in array as arguments for WP_Query
- WP_Query to show post from a category OR custom field
- Getting attachments by meta value
- meta_query where value is equal to given value
- Get_post() with meta_key when compare is a date
- querying with custom meta field with meta_query
- Group posts by custom field
- Order by meta_value_num DESC and meta_value ASC on WP 4.0
- getting posts and number by specific meta value in multiple meta
- How to query using a combination of custom_field values?
- Revolution Slider Orderby Two Custom Fields
- WordPress altering my custom query, How to fix it?
- Order by meta_key in custom post type doesn’t affect the query
- How to show only one post for each categories of taxonomy of custom post that contains a specific custom field
- Custom Field sort not working (WP 3.8.1)
- wp_query with multiple custom fields
- Filtering posts by custom field value not working
- Display link to taxonomy archive only if it has posts with certain custom field values
- getting posts and number by specific meta value in multiple meta
- Order Posts by meta value AND published date
- wp_query add arguments using array_push if variable met
- Group WP_Query by meta_key date
- How To Fix WP Query Returns Results But Shouldn’t?
- Get posts for which a custom field is not present, with get_posts
- Output an array of terms for a ‘tax_query’ => array()
- How to Filter Posts by Custom Fields?
- Display custom field meta outside loop, site wide
- Fetch Record based on meta key dates
- Orderby is working with one query but not with other
- Extend product search with meta in WooCommerce
- how to make members list directory through wordpress post custom meta key.
- Query posts without meta preload
- Adding multiple meta_key fields as orderby options to a WP Query via a function
- Large AND OR query timing out
- meta_value_num not ordering all items
- Categorising search results based on Custom Fields
- Search posts missing a particular custom field
- wp_query get data from advanced custom field in wordpress
- How to compare a date in custom field with today’s date in custom WP_Query?
- Conditional operator OR not working with custom fields
- WP ForLoop to compare meta information of posts to determine what post to display
- WP_QUERY with group by with custom fields
- Intiger meta value with ‘>=’ returns posts with lower value
- Display posts with specific value first in query
- get_posts custom field
- wp_query posts with custom fields number smaller than
- Posts query according to meta box date
- create metabox to activate slider
- Query posts using less than
- Retrieve select tag custom values from array and display them in current page with wp_query?
- How to use a dropdown to filter posts by custom field
- Excluding posts with certain value of meta_key keeping posts without that meta_key
- Query only displays one page_id
- Querying a large number of posts including their custom fields data
- Display post meta conditionally based on it’s value
- Query using string from custom field as array value
- How to show list of posts with custom field value (a date) that are coming soon
- meta_query weird behaviour, static int will work, but not user data
- Query multiple post types, but different order for each
- Order by the first array within a meta_query
- Woocommerce Shortcode which displays a table with product data
- Query ACF relationship field – Comparator IN – Value array
- ACF: How to query for a given value count of an array like field? (e.g.: How many rows has a `flexible_content` field?)
- How to _GET multiple value checkbox WP_Query in Custom Toxonomy / Custom Fields
- display ACF repater field in archive page
- Query posts by post type, author and post meta
- How to use the Term Object from a custom select field in a query
- Trouble with serialized metadata
- Categories In English version showing not canonical URL, instead shows query search result
- Comparing Meta Field date in WPQuery using Meta_Query?
- Query against multiple locations within single custom post type post
- Query post by Category and custom file (ACF)
- WP_Query, ACF field and array
- Problem with my loops
- Order by Date Custom Field
- ACF Post Object meta-query by title not ID
- Sort posts on custom field AND after that sort on date?
- using custom meta user data to run queries in WordPress
- Query by meta value (add a dropdown of all values)
- Query by Category and Custom Field – Shortcode
- WP_Query with Pagination and orderby meta_value_num showing duplicates
- Order Custom Field by Price
- Mathematical operations on custom field values? (updated)
- WP_Query to show post from a category OR custom field – Not 100% answered
- Compare meta key separation
- WP_Query a custom field value bringing back 0 results
- Custom search (wp query by custom fields)
- How do I display posts with specific value in a custom field into my loop?
- Custom Search Query – include only custom fields and title
- query_posts with sorting on a custom datestamp
- Query posts filter not working
- How ‘secure’ are loops?
- Display all custom meta field values from the database using ACF Repeater
- Taxonomy related query not working
- WP_Query – order with usort by custom meta
- Best performance for use Custom Field in WP
- Sort wp_query of two post types using meta datefield for one and date for the other – possible?