How to enable recent comments to display on attachment post

To enable recent comments widget to show comments from your gallery attachment images.
Put this code into your function.php

function wpse80087_widget_comments_args( $args )
$args = array( ‘number’ => 5, ‘post_type’ => ‘attachment’, ‘status’ => ‘approve’, ‘post_status’ => ‘inherit’ );
return $args;
add_filter( ‘widget_comments_args’, ‘wpse80087_widget_comments_args’, 10, 1 );

Thanks to Diggy

Leave a Reply

Your email address will not be published. Required fields are marked *