I don't want people to have to log in, I just want to prompt them with a question and if they can answer it, they can access the site. All the solutions and plugins that I've found seem to be overkill for my needs. Does this kind of thing exist?


2 Answers 2


You could add a statement to the end that require them to answer a question if they dont have a cookie set and sets a cookie when they do, allowing them access to the site. I'm on my phone but something like this.

if($_POST['q'] == 'answer') { 
// set cookie
} elseif($_COOKIE['q'] != 'cookie') {
// include question template and die
  • this is the kind of thing that I am looking for, I was just hoping that there was a plugin that did it for me :-)
    – ninesided
    Dec 28, 2011 at 22:11
  • I'll modify the code I've written to provide a full solution, if you like - let me know. You can accept my post as an answer using the little green tick to the left of it, if you feel I've helped. Dec 28, 2011 at 22:49
  • if you wouldn't mind that would be much appreciated - I'll +1 you for now, will give you a tick if it works :-)
    – ninesided
    Dec 28, 2011 at 23:08

Alternatively, you could use HTTP authentication on your webserver for the folder your WordPress installation resides in.

If you're using Apache, you can use the following documentation to configure it: http://httpd.apache.org/docs/2.2/howto/auth.html

If you use Lighttpd, you can check out this page: http://2skies.com/docs/basic_http_authentication_with_lighttpd

  • wouldn't this require both a username and a password? I wouldn't have the opportunity to ask the user the secret question!
    – ninesided
    Dec 28, 2011 at 22:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.