If you want to display the info on the current user logged in you can use get_currentuserinfo
. [Codex]
Example from Codex
<?php global $current_user;
get_currentuserinfo();
echo 'Username: ' . $current_user->user_login . "\n";
echo 'User email: ' . $current_user->user_email . "\n";
echo 'User first name: ' . $current_user->user_firstname . "\n";
echo 'User last name: ' . $current_user->user_lastname . "\n";
echo 'User display name: ' . $current_user->display_name . "\n";
echo 'User ID: ' . $current_user->ID . "\n";
?>
Or if you want display the info for a user that is not the current user logged in, you can use get_userdata
. [Codex]
The two links to the WP Codex should provide you with the syntax of the two functions. If you have any further questions or they did not work please ask.
Related Posts:
- Query posts only with featured image
- why ignore_sticky_posts in sticky post query
- get_query_var function not working at all
- get_query_var( ‘paged’ ) not working outside of homepage
- Order by Category and Post in WP custom Query
- get custom post type by tag
- Does tax_query really beats meta_query in all situations?
- Execute a large WP_Query with many “AND” Meta_Queries?
- Using WP_Query To Get Posts Randomly From today
- How to know which one is the main query?
- WP_Query can’t exclude more than 1 author?
- Finding all results from database within 500 miles of the given latitude and longitude [closed]
- How to order posts by custom WP role?
- Generate a tabbed submenu — from taxonomy term or submenu item — with sample content
- posts2posts query using connected_items array issue [closed]
- WP Query and order by particular specified IDs
- Get the post permalink within the loop but without additional DB query
- Display revision if post status is pending
- Meta query field order together with post_date order causes posts without the meta field to be unordered
- How To Remove/hide some specific categories from two different categories widget from sidebar
- WP Query search for attachments and their exact title
- How to add another parameters to WP_Query?
- Undefined property: WP_Query::$post
- Excluding Sticky Posts from The Loop and from WP_Query() in WordPress?
- How to display posts month by month?
- Display posts with date wordpress default
- Query different number of posts with different formats in one go
- Extending woocommerce admin product search
- Pagination is broken and I need help fixing it
- Query total number of posts
- How to display a posts 1 year ago with custom WP_Query loop?
- Check on which page specific result exist
- WC displaying products from category
- Loop returning only 1 result
- Fetch posts that match term slug first two letters (wp query)
- How can I use $wp_query->tax_query as tax_query parameter for a new WP_Query instatiation?
- How does one perform a sub query with different post types
- Query with search and subscribers only output
- Query Page Content From Theme Options?
- Taxonomy order exception for specific term
- next_post_link / previous_post_link not working with WP_Query
- Include post content of linked posts in search
- How to Create a Random List of Child Pages
- Query_posts works when appending via AJAX call wp_query doesn’t?
- Is there a way to make this kind of loop shorter and nicer?
- How to make posts unqueryable/unpublish posts where ACF relationship field is an unpublished post? [closed]
- WP Query ordering on a meta field for posts with a date in the future not ordering by datetime
- Merge 2 custom post type posts and taxonomy terms and sort ascending
- Get all posts with empty meta_value
- Count identical post titles
- get_page meta query not working, maybe a bug?
- Query by date from custom field
- pass parameters through variable to WP_QUERY
- What is wrong with my WP_Query Arguments?
- Query of all pages, including children, ordered by meta key
- specific post is not excluded from the loop
- Unable to paginate a custom page query
- How to change the default post type over the loop?
- Trouble Making WP_Query paged
- How to WP Query custom multiple custom taxonomies?
- Sort posts using multiple custom fields and menu_order in single query?
- get_the_terms has strange result since version 6.0
- How to display posts from custom post type category(custom Taxonomy) wise?
- prevent get_comments() from returning comments not in comment__in
- WP Query should show No Posts when tax_query $args taxonomies don’t have associated posts
- How to make WPQuery custom post type work in Twig / Timber
- get_posts return only first result
- How to allow a variable with “/” in wordpress url
- Getting posts by custom field value
- How to get taxonomy image attached to a Post Type WordPress
- How to display a post(by id) along with css in a page?
- search multiple keywords with wp_query using one query
- Order posts by tags count?
- Strange results from WP_Query
- update_post_meta performance in a loop woocommerce
- Display posts side by side with custom query
- Is there a way to control both Order By and Order query parameters from one input field
- WordPress For Loop Prints Unwanted Extra Paragraph Element
- return child post if available otherwise parent post
- Custom Order Current Query: By Meta Key and Category
- Search has query that will return no results
- remove_action – pre_get_posts – does not restore original query
- WP_Query doesn’t work when url parameter is added
- why ignore_sticky_posts in sticky post query
- Woocommerce orderby rand with tax_query not random
- Select Unique Posts for a List of Tags
- How to modify WP Query to target the first most recent post to adjust content
- Some doubts about how the main query and the custom query works in this custom theme?
- WP_Query always returning the last custom post
- Trying to Exclude Sticky Posts From date_query
- Load 3 posts in flexslider slide [closed]
- Pagination error WordPress multiple loop
- Multiple wp_query loops showing first 5 posts on all pages instead of older posts[Resolved]
- get_posts works but new wp_query doesn’t
- SQL returned by Wp_Query has wp_posts.ID = -1
- $query conflicting with other queries in the same page
- Custom query (author is post_author or meta co_author) with Pagenavi pagination
- How to sort by post_date and meta_value_num?
- How can I get taxonomy term name using term slug & post ID using build in WordPress function or class?
- Why does wp_query only display the most recent post when using order ASC?