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
Learn how Jetpack can help you protect, speed up, and grow your WordPress site.
Get up to 50% off your first year.
Compare plans