From 1477915de4c712f9ac1fe5e969444893bc9c291d Mon Sep 17 00:00:00 2001 From: Salman Date: Tue, 25 Nov 2014 13:03:06 -0500 Subject: [PATCH] Disable Comments on Media Attachment Pages --- functions.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/functions.php b/functions.php index aa5125c..56290cb 100644 --- a/functions.php +++ b/functions.php @@ -284,4 +284,14 @@ function hale_main_nav_fallback($args) { } return; } + +function disable_comments_media_attachments( $open, $post_id ){ + $post = get_post_type( $post_id ); + if( $post == 'attachment' ) { + $open = false; + } + return $open; +} +add_filter('comments_open', 'disable_comments_media_attachments', 10 , 2); + ?> \ No newline at end of file