large shade tree

Navigation

Information

Recent Posts

Shade Tree Sites |Building Better Websites

Disable Comments on WordPress Media Attachments

Paste this into your functions.php file to disable comments on wordpress media attachments:

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 );