Hi there. I am trying to get reCAPTCHA to work with a form that I would like to use on my website. The form is for posting job listings. Every time I try to add the reCAPTCHA PHP code, it breaks my theme and displays an error. I have also tried to add the reCAPTCHA PHP code as a function in the functions.php file, and call it with:
<?php myCaptcha ();?>
but it still breaks the theme and gives this error:
Warning: require_once(/scripts/recaptchalib.php) [function.require-once]: failed to open stream: No such file or directory in /home/-my_username-/-my_domain-/wp/wp-content/themes/wsba_theme/functions.php on line 11
here is the functions.php code:
<?php function myCaptcha() {
// Include the reCAPTCHA library, this assumes a relative directory.
require_once('/scripts/recaptchalib.php');
// Get a key from http://recaptcha.net/api/getkey
$publickey = "KEY REMOVED";
// The response from reCAPTCHA
$resp = null;
// The error code from reCAPTCHA, if any
$error = null;
echo recaptcha_get_html($publickey, $error);
}
?>
I definitely have the recaptchalib.php located in the /scripts directory under the domain root. The file that processes the form is also located in the /scripts folder and it works just fine, so I don't think it's a path issue.
My WordPress installation is located in its own directory also under the domain root (/wp).
Basically I got the idea of using reCAPTCHA in this way after I read this page: http://blog.mclaughlinsoftware.com/2009/07/18/recaptcha-on-wordpress/comment-page-1/#comment-10885
I am using the wp-recaptcha plugin for my comments and the register plus plugin for registrations and they are both using reCAPTCHA without any problems.
Any ideas?