How To Turn Off WordPress Comments Feature Programmatically

I would like to turn off WordPress comments programmatically but do not want to disable them one by one

You can use WordPress filter – comments_open to hide WordPress comments

add_filter( 'comments_open', 'comments_open_plugin', 10, 2 );

function comments_open_plugin( $open, $post_id ) {
    return false;
}
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments