I have a plugin that has input form, I have decided to check submitted data with akismet. I do have API key, WP comments are filtered correctly…
here is, what I found: http://www.binarymoon.co.uk/2010/03/akismet-plugin-theme-stop-spam-dead/
problem is, that $response
is always empty – I have tried to var_dump()
it, right after calling akismet_http_post()
, output was string(0) ""
…
Can you give me a hint what I did wrong?
Thanks
The problem is the globals
global $akismet_api_host, $akismet_api_port;
are not available everywhere. I suggest calling your function in the “init” hook…Check out the Akismet API documentation.
The other option is to use one of these wrapper classes:
https://github.com/tijsverkoyen/Akismet
OR
https://github.com/achingbrain/php5-akismet