What is the purpose of having a token in cookies?

According to the WP_Session_Tokens class documentation, this token is used to validate the user’s session. It does this by checking the provided token against the existing session tokens stored in the user meta table for that user.

Session tokens are generated using the wp_generate_password function, and are 43 characters long. So no, it should not be predictable.

You can check out the source to learn more about how session tokens are created, and how cookies are verified.

Leave a Comment