Get current user id in function php
You’re running your code on the wp_loguout hook, which is after the user has logged out, so of course there’s no current user ID. There’s no current user at all. If you look at the documentation for the wp_logout hook, you will see that the ID of the user that was logged out is passed … Read more