Today, We want to share with you How to get current user Information in word press.In this post we will show you Word-press – Fetch current user Information, hear for How to Get Logged-in User’s Info in Word-Press we will give you demo and example for implement.In this post, we will learn about How To: Get the Current Active Logged in User ID, Name, Email in Word-Press with an example.
How to get current user details in wordpress
There are the Following The simple About Fetch current user Data Information Full Information With Example and source code.
As I will cover this Post with live Working example to develop get current user session in wordp-ress, so the get current user id function in WordPress for this example is following below.
How to Retrieve current user All Info in word-press?
<?php include ('wp-load.php'); global $current_user; $current_user = wp_get_current_user(); var_dump($current_user); ?>
GET CURRENT USER ROLE IN WORDPRESS
<?php /** * Get the user's roles * @since 1.0.0 */ function wcmo_get_current_user_roles() { if( is_user_logged_in() ) { $user = wp_get_current_user(); $roles = ( array ) $user->roles; return $roles; // This returns an array // Use this to return a single value // return $roles[0]; } else { return array(); } }
How To: Get the Active Logged in User ID in WordPress
$current_user_id = get_current_user_id(); echo 'Your User ID is: ' .$current_user_id;
Web Programming Tutorials Example with Demo
Read :
Summary
You can also read about AngularJS, ASP.NET, VueJs, PHP.
I hope you get an idea about How to Fetch wordpress current user details.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.