How to Disable WordPress Comments Media Attachments ?

You can very easily disable comments on WordPress media attachments. Open your theme’s function.php file and add the following hack:

function filter_media_comment_status( $open, $post_id ) {
$post = get_post( $post_id );
if( $post->post_type == ‘attachment’ ) {
return false;
}
return $open;
}
add_filter( ‘comments_open’, ‘filter_media_comment_status’, 10 , 2 );

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.