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


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.

  • But will this close all comments? I want to allow comments through Disqus - just not the ones coming in through the API.
    – ChrisJ
    Mar 8, 2013 at 10:54
  • @ChristopherJ it will close all WordPress comments. Disqus comments will work. 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.
    – ChrisJ
    Jul 29, 2013 at 1:54

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);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.