Answers for "get user id from wp_users using a variable as key"

PHP
10

wp get logged in user id

<?php
	$user_id = get_current_user_id();
?>
Posted by: Guest on April-14-2020
1

get_user_meta

global $current_user; 
 
get_currentuserinfo();
 
if ( $current_user ) {
    $permission = get_user_meta( $current_user->ID, 'some_meta' , true );
     
    if ( ! empty( $permission ) ) {
        // do stuff
    }
}
// works for both array and single values
Posted by: Guest on November-13-2020

Code answers related to "get user id from wp_users using a variable as key"

Browse Popular Code Answers by Language