I’ve blocked access to xmlrcp, and removed most everything that is generated in wp_head
. However, I’m still getting notifications in the admin about comments being posted on posts even when there is no form on that page. How is this possible?
I’m thinking that this below would work:
// Remove comment support
add_action( 'init', function() {
remove_post_type_support( 'page', 'comments' );
remove_post_type_support( 'post', 'comments' );
});
// Close open comments
add_filter( 'comments_open', function( $open, $post_id ) {
$post = get_post( $post_id );
if ( 'page' == $post->post_type || 'post' == $post->post_type )
$open = false;
return $open;
}, 10, 2 );
However, whether the above works or not, I’m still wondering how someone/ or a spam bot is able to post a comment when there is no form or anything on the page.