Put a PIN on a gallery
Open the gallery, go to Settings, and find Guest link PIN.
Generate guest PIN creates the code. Regenerate PIN replaces it, which is what you want if a link has spread further than you meant. Remove PIN takes it off again.
The screen is blunt about the default: with no guest PIN set, the gallery link alone will not let anyone in once you have turned a PIN on, and before that the link is the only protection there is. For a wedding that is usually fine. For anything sensitive, set a PIN.
You can also set an expiry date on the gallery, or leave it as No expiry.