$current_user doesn't work inside login hook
-
I’m using $current_user to get user’s ID & it works fine but when I use this variable inside login hook, it doesn’t work. Here is my code:
add_action('wp_login','Insert'); function Insert(){ global $wpdb; $table_name = $wpdb->prefix."userlog"; $date = date('Y-m-d H:i:s'); $wpdb->insert( $table_name, array('user_id' => $current_user->ID,'log_date_time' => $date )); }
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘$current_user doesn't work inside login hook’ is closed to new replies.