Sometimes, you may not want your readers to comment on single images. If that’s the case, you can deactivate comments on all attachment pages and in the Carousel view by adding this code snippet to your theme’s functions.php file:
function tweakjp_rm_comments_att( $open, $post_id ) { $post = get_post( $post_id ); if( $post->post_type == 'attachment' ) { return false; } return $open; } add_filter( 'comments_open', 'tweakjp_rm_comments_att', 10 , 2 );
Explore the benefits of Jetpack plans
Compare plans in detail to see how Jetpack can help you design, market, and secure your WordPress site.
Compare plans