WP est connecté à l'ID utilisateur
<?php
$user_id = get_current_user_id();
?>
Confused Copperhead
<?php
$user_id = get_current_user_id();
?>
$current_user = wp_get_current_user();
echo($current_user->user_login);
echo get_the_ID();
function get_the_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
$post = get_post();
return ! empty( $post ) ? $post->ID : false;
}
$user_obj = get_user_by('id', 1);
$user = get_user_by( 'email', '[email protected]' );
$userId = $user->ID;