Add an access code form to call a unique page based on page without registration

If your code is truly going to be the slug (“secret-page” = example.com/secret-page), you could do something like this…

wp_redirect(get_bloginfo('url')."https://wordpress.stackexchange.com/".$_POST['access_code']);

But realize that headers cannot have already been sent, so this needs to happen before get_header(). Some more testing would be needed, but that should get you down the right path in principle.

You could also have the form’s action be "https://wordpress.stackexchange.com/", method as $_GET and make the name of the input be "name" (<input name="name" ...>).

So if you visit

example.com/?name=my-secret-page

you will end up at

example.com/my-secret-page

as that is default behavior when using “pretty” permalinks