wp_get_current_user
will get you the WP_User
object for the currently logged-in user:
add_action( 'wp_ajax_create_team', 'create_team' );
function create_team() {
$current_user = wp_get_current_user();
echo $current_user->ID;
die;
}
wp_get_current_user
will get you the WP_User
object for the currently logged-in user:
add_action( 'wp_ajax_create_team', 'create_team' );
function create_team() {
$current_user = wp_get_current_user();
echo $current_user->ID;
die;
}