Fastest way to get user ID in wordpress
There are various ways to get user_ID in WP. But which one is the fastest ? I’ve compared 3 ways function get_uid_from_global() { global $current_user; return $current_user->ID; } function get_uid_by_gcuid() { return get_current_user_id(); } function get_uid_by_wpgcu_id() { return wp_get_current_user()->ID; } Without a doubt, global method was fastest. With multiple 100,000 runs, global method took 0.9~…