To mitigate the spam submitted to our mailing lists (and those of our clients via our partner plugin), we recently looked at how we could integrate Akismet into our own suite of tools. When looking for the relevant codex page, the first result that popped up via our search was a function written by Binary Moon . The code, largely lifted directly from the Akismet WordPress Plugin with only minor modifications, returns a Boolean result.
The simple functions power comes from its versatility; it can easily be integrated into virtually any form-based WordPress application that accepts Akismet-aware content. Used in conjunction with other tools it goes a long way to completely shielding against unwanted junk submissions.
The function accepts a $content
array with name, email, website, and comment values. The returned Boolean is either true
(spam) or false
(not spam).
PHP Function
Considerations
- If you're working outside of WordPress there's a large number of libraries on Github that you can check out.