Hi there!
Check out wp-pass.php in your wordpress directory.
You’ll find a line like this:
setcookie('wp-postpass_' . COOKIEHASH, $_POST['post_password'], time() + 2, COOKIEPATH);
The value after the “+” indicates the time in seconds, the cookie stays valid. In this example it is valid for 2 seconds, setting it to 7200 would be equivalent to 2 hours.
This solution works for me.
You may find further information on:
https://www.php.net/manual/en/function.setcookie.php
Greetings
matthias