3

We're using the disqus plugin on our wordpress site, so anyone commenting should have a login through disqus. Yet, I'm still seeing spammers trying to post through the regular comments API. They're not getting through to the post, but they're clogging my inbox as admin.

How do I disable this API - I only want to accept comments that come from a logged in Disqus user?

2 Answers 2

6

There is much easier way to close standard WordPress comments. Just add

add_filter( 'comments_open', '__return_false' ); 

to your functions.php file and comments will be closed.

3
  • But will this close all comments? I want to allow comments through Disqus - just not the ones coming in through the API. Commented Mar 8, 2013 at 10:54
  • @ChristopherJ it will close all WordPress comments. Disqus comments will work. Commented Mar 8, 2013 at 10:57
  • It's reduced our load. We're still getting some sneaking in through trackbacks, but I guess that's a different API point. Commented Jul 29, 2013 at 1:54
3

You can try to stop it in the pre_comment_on_post hook

add_action('pre_comment_on_post', 'no_wp_comments'); function no_wp_comments() { wp_die('No comments'); } 

I use this when I use Facebook comments instead of Wordpress comments.

Here is a similar example with an anonymous function:

add_action('pre_comment_on_post', create_function( '','wp_die("No comments");')); 

but I prefer the first example, it's easier to modify.

This hook is in the file wp-comments-post.php as:

do_action('pre_comment_on_post', $comment_post_ID); 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.