wp get logged in user id
<?php
$user_id = get_current_user_id();
?>
wp get logged in user id
<?php
$user_id = get_current_user_id();
?>
wordpress get username
$current_user = wp_get_current_user();
echo($current_user->user_login);
wordpress get user by id
$user_obj = get_user_by('id', 1);
how to display user id from a function on a wordpress page
function get_current_user_id() {
if ( ! function_exists( 'wp_get_current_user' ) ) {
return 0;
}
$user = wp_get_current_user();
return ( isset( $user->ID ) ? (int) $user->ID : 0 );
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us