<?php global $wpdb; $user_id = get_current_user_id(); $user = $wpdb->get_row( "SELECT * FROM score WHERE user_id = ".$user_id.""); if(!empty($user)){ $score = $user->score; } ?>