All,
I’ve got a Page in WordPress that I’m creating to allow some people to submit some feedback on to me. On my page I’ve got the following code to include the reCaptcha:
<?php
require_once('http://localhost/website/recaptchalib.php');
$publickey = "12345"; // you got this from the signup page
?>
Then where I want the reCaptcha displayed I’ve got the following bit of code:
<?php echo recaptcha_get_html($publickey); ?><div id="captchaStatus"></div>
However, when I try and display this page I get the following error message from WordPress:
Fatal error: Call to undefined function recaptcha_get_html()
Is there a better way to include the reCaptcha on a WordPress page? I know there is a reCaptcha plugin but I believe that is only for pages with Comments on it which isn’t my need here.
Do I need to not include it as a link and instead a path to the recaptcha page? If so, how can I do that from a page in WordPress to my base folder?
Any advice is greatly appreciated.
Thanks
Not sure if you’ve written it this way for example purposes, but your
require_oncecall is using a http request to try and include from, and as such I don’t think your lib will be included correctly.Try using the proper file path to the
.phpfile you’re trying to include, i.e.local/path/to/file.php.The include path will look for local files on the disk – not make a http connection to a file.
For reference: http://www.php.net/manual/en/ini.core.php#ini.include-path
I believe WordPress specifies an
ABSPATHconstant inwp-config.phpthat you can use to get the root path of your WP install.