Search
 
SCRIPT & CODE EXAMPLE
 

PHP

wordpress get username

$current_user = wp_get_current_user();
echo($current_user->user_login);
Comment

wordpress get current logged in user

// get the current logged-in user object
$user = wp_get_current_user();
Comment

current user wordpress

$current_user_id = get_current_user_id();
$current_user = wp_get_current_user();
Comment

How to Show the Logged in Username in the WordPress

function show_loggedin_function( $atts ) {

	global $current_user, $user_login;
	get_currentuserinfo();
	
	add_filter('widget_text', 'do_shortcode');
	if ($user_login) 
		return '<h4 class="logged-in-user">Hi ' . $current_user -> display_name . ' !</h4>';
	else
		return '<a href="' . wp_login_url() . ' ">Login</a>';
	
}
add_shortcode( 'show_loggedin_as', 'show_loggedin_function' );

//Shortcode
[show_loggedin_as]
Comment

PREVIOUS NEXT
Code Example
Php :: array prepend php 
Php :: laravel 8 routes namespace 
Php :: php array length for loop 
Php :: erreur php 
Php :: woocommerce show data to cart page 
Php :: left join laravel 
Php :: insert data in database using seeder in laravel 
Php :: laravel date format 
Php :: php 
Php :: laravel show debug query sql 
Php :: laravel migrate specific table 
Php :: eloquent with select 
Php :: Laravel eloquent upserts 
Php :: how to share a helper globally laravel 
Php :: lodash tester 
Php :: how to create controller inside folder in laravel 
Php :: steps to create laravel project 
Php :: make migration file in laravel 
Php :: php extract array 
Php :: update user role wordpress 
Php :: how to add php file in html 
Php :: php curl Content-Length 
Php :: add custom style to wordpress editor 
Php :: migration rename column laravel 
Php :: store fetched data into array php 
Php :: get domain url with https in laravel 
Php :: wordpress get order 
Php :: laravel spatie asigne role 
Php :: php delete directory 
Php :: how to pass bearer token in swagger in laravel 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =