I need to perform some cleanup after a user logged out, so I added a wp_logout action hook. Problem is, wp_get_current_user() already returns null if called from within the wp_logout action hook. How do I get the logging out users userid inside a wp_logout action hook?

3 s
How about hooking 'clear_auth_cookie'
with the cleaning you need to do? If you need even more depth, you can outright replace wp_clear_auth_cookie()
, but that can get into issues where it will conflict with other plugins, so avoid that if possible.