如何在提交之前获取评论内容(WordPress)?
我想对 WordPress 评论功能做一点改变。这将帮助我防止垃圾邮件发送者。我的想法是:
当提交评论表单时,我的函数将获取评论内容(电子邮件,网站,内容......),如果其中之一或全部包含黑名单中的某些单词,则评论将立即被拒绝。
请告诉我该功能可以帮助我获取评论内容以及我可以在哪里采取行动。
非常感谢 !
I want to made a little change for WordPress comment function. That will help me prevent spammers. My idea is:
When comment form is submitted, my function will get the comment content (email, website, content,..) if one of them or all of them are contained some words that in blacklist, the comment will be reject immediately.
Please tell me know the function help me get comment content and where can I put to action.
Thanks so much !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能需要查看钩子 comment_post_redirect,该钩子在表单发布后调用。您可能希望验证该评论。
或者您可以使用钩子 comment_post,该钩子在将评论保存到数据库后运行,但您仍然可以将其标记为垃圾邮件。
You may want to check out the hook comment_post_redirect, which is called after the form is posted. There you may wish to verify the comment.
Or you can use the hook comment_post, which runs after saving the comment to DB, but you can still mark it as SPAM.