Is it possible to direct users to a certain post based on a password entered on the home page?

I’d like to be able to have a workflow that works like so:

  1. Create a post and assign it a password
  2. Have a single-field form on the home page
  3. User enters password on home page, and is sent to the corresponding post

Does anyone know if this is possible?

5 Answers
5

Yes, but you’ll need to hold the details of how a password maps to a post.

So:

  • store mappings somewhere, easiest as a hash/key-value pair (password->post_id)
  • get password from field
  • determine post_id, and construct the URL
  • use wp_redirect() to redirect the user.

Leave a Comment